This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

Creating an Object from a JSON String

const txt = '{"name":"John", "age":30, "city":"New York"}';

// parse JSON
const obj = JSON.parse(txt);
document.getElementById("demo").innerHTML = obj.name + ", " + obj.age;