JSFiddle - React, Tailwind, and code Playground
JavaScript
fetch('/echo/json').then(response => response.json().then(() => {debugger;}));
fetch('/echo/json').then(response => response.text().then(text => json(text).then(() => {debugger;}));
function json (jsonString) {
return new Promise((resolve, reject) => {
try {
const jsonObject = JSON.parse(jsonString);
resolve(jsonObject);
} catch(e) {
reject(e);
}
})
}