Convert JSON String into Javascript Object

Hey guys in this post, we will discuss converting JSON string into a javascript object

Convert Javascript object into a JSON String check here

By using JSON.parse() method

We can use JSON.parse() method to convert JSON string into a javascript object. We should pass the JSON string as a parameter to the parse() method.




Consider the following employee JSON –

const employeeJSON = `{"name":"Bushan","age":28,"location":"India"}`;

Use JSON.parse() to convert it to javascript object

const employeeObj = JSON.parse(employeeJSON);
console.log("Employee Object:", employeeObj);


Employee Object: {name: "Bushan", age: 28, location: "India"}

Bushan Sirgur

Hey guys, I am Bushan Sirgur from Banglore, India. Currently, I am working as an Associate project in an IT company.

Leave a Reply