How to convert JSON to JavaScript object

In this shot, we will learn how to convert a JSON string into a JavaScript object.

Syntax

JSON.parse(JSONstring)

Where JSONstring is the JSON string to parse. This method returns a JavaScript object.

JSON.parse(JSONstring) will raise an error if the passed string is not in a valid JSON format.

Code

Suppose you have a string JSON such as:

'{ "name": "John", "age": 20, "isYoung": true}'

To convert the above string into a JavaScript object, run:

let stringJSON = '{ "name": "John", "age": 20, "isYoung": true}';
let object = JSON.parse(stringJSON);
console.log(object);
New on Educative
Learn any Language for FREE all September 🎉
For the entire month of September, get unlimited access to our entire catalog of beginner coding resources.
🎁 G i v e a w a y
30 Days of Code
Complete Educative’s daily coding challenge every day in September, and win exciting Prizes.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved