Response.prototype.json

Returns promise that resolves to the response parsed as a JSON object.

Syntax

json()

Return value

An promise that resolves to an object.

Rejects the promise with SyntaxError if the response is not a valid JSON.

Examples

let response = await fetch('https://example.com')
let result = await response.json()