Web APIs

Response.json()

Try the free JavaScript compiler

Consumes the body and parses it as JSON. Invalid JSON rejects; the result is not schema-validated.

Formal Syntax & Structure

javascript syntaxjavascript
response.json()

Return Value

Promise<any>

Parsed JSON value.

Working Example

Example Snippetjavascript
(async () => {const r=await fetch("data:application/json,%5B2%2C5%5D");const a=await r.json();console.log(a.length,a[1]);})()
JavaScript Reference