0 votes
in JavaScript by
How do you parse JSON string?

1 Answer

0 votes
by

When receiving the data from a web server, the data is always in a string format. But you can convert this string value to a javascript object using parse() method.

var userString = '{"name":"John","age":31}';
var userJSON = JSON.parse(userString);
console.log(userJSON); // {name: "John", age: 31}

Related questions

0 votes
asked Mar 15 in JavaScript by DavidAnderson
0 votes
0 votes
asked Jul 20, 2020 in JSON by Robindeniel
...