1var person={"first_name":"Tony","last_name":"Hawk","age":31};
2var personJSONString=JSON.stringify(person);
1var jsonPerson = '{"first_name":"billy", "age":23}';
2var personObject = JSON.parse(jsonPerson); //parse json string into JS object
1Use the JavaScript function JSON.parse() to convert text into a JavaScript object:
2var obj = JSON.parse('{ "name":"John", "age":30, "city":"New York"}');
1const json = '{"result":true, "count":42}';
2const obj = JSON.parse(json);
3
4console.log(obj.count);
5// expected output: 42
6
7console.log(obj.result);
8// expected output: true