ApplesauceOS
Read Markdown ↗Download .md

Response.json

Consume an HTTP response body.

js
response.json()

Arguments

No arguments.

Returns

Promise of parsed JSON; invalid JSON rejects.

Example

js
(async () => {
  const response = await fetch("https://example.com");
  console.log(await response.json());
})().catch(error => { console.error(error.message); throw error; });

Notes

Use either text() or json() once; a second consumption rejects. The json() example requires an endpoint returning valid JSON.

All JavaScript APIs · Automation playbook