Want 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.
Here is an example:
1 2 3 4 5 | const json = '{"result":true, "count":42}'; // Parse the object const obj = JSON.parse(json); console.log(obj.count); console.log(obj.result); |
The output will be:
1 2 | 42 true |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.