JSON -> HTML

PHOTO EMBED

Sun Aug 07 2022 15:33:30 GMT+0000 (Coordinated Universal Time)

Saved by @aaryaman #js #json

let a = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}';
let b = JSON.parse(a);
document.getElementById("divid").innerHTML = b.title;

// Using fetch
fetch ('https://jsonplaceholder.typicode.com/todos/1')
.then(res => res.json())
.then(json => document.getElementById("divid").innerHTML = json.title);
content_copyCOPY