On this page
  1. JSON.parse
  2. Signature & Overview
  3. Notes & Pitfalls
  4. Example

JSON.parse

Prev: JSON | Up: JSON | Next: stringify
Rel: JSON, JSON, Math, BigInt & Date Guide
Ref: MDN Web Docs — JSON.parse
Tags: #public #web #javascript #builtins #json #tier/core


Signature & Overview

JSON.parse(text, reviver?)

Parses a JSON string into a JavaScript value; throws SyntaxError on invalid input.

Notes & Pitfalls

Example

const data = JSON.parse('{"id":1,"ok":true}');
console.assert(data.id === 1 && data.ok === true);

Linked from

Related notes