Computer >> Computer tutorials >  >> Programming >> Javascript

How to deserialize a JSON into Javascript object?


JSON is literally Javascript Object notation. JS has built in support using the JSON object to parse JSON strings into JS objects.

Example

You can use it in the following way −

const json = '{"result":true, "count":42}';
// Parse the object
const obj = JSON.parse(json);
console.log(obj.count);
console.log(obj.result);

Output

This will give the output −

42
true