Open this example in the interactive library
Source code
const response = new Response(JSON.stringify({ ok: true }), {
headers: { "Content-Type": "application/json" },
});
console.log(await response.json());
Sample output
{ ok: true }
Parse a JSON response. A self-contained example using the JavaScript runtime.
Open this example in the interactive library
const response = new Response(JSON.stringify({ ok: true }), {
headers: { "Content-Type": "application/json" },
});
console.log(await response.json());
{ ok: true }