fetch('https://mywebsite.com/posts/. . . ') .then(data => { if (!data.ok) { throw Error(data.status); } return data.json(); }) .then(post => { console.log(post.title); }) .catch(e => { console.log(e); });