JavaScript JSON Object
The JSON object contains methods for converting between JavaScript values and JSON text: JSON.parse() reads JSON and JSON.stringify() writes it.
Description
The JSON object is a namespace holding methods for working with JSON (JavaScript Object Notation), the text format most web APIs use to exchange data. It is not a constructor: you can't use new JSON(), you just call its methods.
JSON.parse() turns a JSON string into a JavaScript value, and JSON.stringify() turns a value into a JSON string. JSON only supports objects, arrays, strings, numbers, booleans and null, so values such as functions, undefined, Map and Date objects are dropped or converted when you stringify them.
JSON text is more limited than JavaScript object syntax: keys must be double-quoted strings, there are no comments or trailing commas, and the only values are objects, arrays, strings, numbers, true, false and null. A quick way to deep-copy plain data is JSON.parse(JSON.stringify(value)), but structuredClone() is better because it keeps dates, maps and sets intact. When reading responses from fetch(), the response.json() method parses the body for you.
Syntax
JSON.parse(text)
JSON.stringify(value)Static methods
| Name | Description |
|---|---|
JSON.parse() | The JSON.parse() static method reads a string of JSON text and turns it into the JavaScript value it describes, such as an object or array. |
JSON.stringify() | The JSON.stringify() static method converts a JavaScript value, such as an object or array, into a JSON string. |
Example
Browser Support
The following information will show you the current browser support for the JSON object. Hover over a browser icon to see the version that first introduced support for this object.
Desktop





Tablets & Mobile





