JSON.parse()
Parses the data and converts it into a JavaScript object
let txt = '{"name":"John", "age":30, "city":"New York"}'

// Converts JSON string into a JavaScript object.
let obj = JSON.parse(txt);

// Puts the data into "p" element with id: demo
document.getElementById("demo").innerHTML = obj.name + ", " + obj.age;
by Valeri Tandilashvili
4 years ago
JSON
JavaScript
JS JSON
1
Pro tip: use ```triple backticks around text``` to write in code fences