const jsonString = '{ "key": "value", "key2": ["a","b"] }';
const obj = JSON.parse( jsonString );
alert( obj.key ); // "value"
alert( obj.key2[1] ); // "b"
var oTemp = JSON.parse(buf.toString());
Copy
1const jsonStr = '{"name":"Infinitbility","gender":"male"}';
2const jsonObj = JSON.parse(jsonStr);
3console.log(jsonObj); // {name: 'Infinitbility', gender: 'male'}
4console.log(jsonObj.name); // Infinitbility