JS-json_parse

PHOTO EMBED

Mon Jul 24 2023 23:25:37 GMT+0000 (Coordinated Universal Time)

Saved by @taha125 #undefined

<!DOCTYPE html>
<html>
<body>
​
<h2>Creating an Object from a JSON String</h2>
​
<p id="demo"></p>
​
<script>
const txt = '{"name":"John", "age":30, "city":"New York"}'
const obj = JSON.parse(txt);
document.getElementById("demo").innerHTML = obj.name + ", " + obj.age;
</script>
​
</body>
</html>
​
content_copyCOPY

https://www.w3schools.com/js/tryit.asp?filename