Download to read offline

![JSON.parse() takes a JSON string and transforms it
into a JavaScript object.
Syntax:
JSON.parse( stringValue, [reviver] );
- stringValue JSON-string to parse
- reviver function(key, value), function to
transform the value
const json = ‘{"string":"Hello
Nugget!","number":123456,
"boolean":false,"test":null}’;
let obj = JSON.parse(json);
console.log(obj);
console.log(obj.string);
//Output
{
string: “Hello Nugget!”,
number: 123456,
boolean: false,
null: null
}
Hello Nugget!](https://image.slidesharecdn.com/ilsiv9nsqwrgqbsnfgew-signature-532f4a33c26a739923d5fdcf3cdebd912654975cf20903351a97f459c1f97aab-poli-200616031520/75/Json-parse-in-JavaScript-2-2048.jpg)


json.parse() converts a JSON string into a JavaScript object. It accepts a string value and an optional reviver function to modify the parsed values. The document includes examples demonstrating the syntax and the use of the reviver function.

![JSON.parse() takes a JSON string and transforms it
into a JavaScript object.
Syntax:
JSON.parse( stringValue, [reviver] );
- stringValue JSON-string to parse
- reviver function(key, value), function to
transform the value
const json = ‘{"string":"Hello
Nugget!","number":123456,
"boolean":false,"test":null}’;
let obj = JSON.parse(json);
console.log(obj);
console.log(obj.string);
//Output
{
string: “Hello Nugget!”,
number: 123456,
boolean: false,
null: null
}
Hello Nugget!](https://image.slidesharecdn.com/ilsiv9nsqwrgqbsnfgew-signature-532f4a33c26a739923d5fdcf3cdebd912654975cf20903351a97f459c1f97aab-poli-200616031520/75/Json-parse-in-JavaScript-2-2048.jpg)
