Favorites

JavaScript JSON Object

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
JSON
JavaScript Structured Data · NamespaceThis object is supported by all modern browsers.
Updated 28th November 2026

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

NameDescription
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

const user = { name: 'Sam', age: 30, tags: ['admin'] };

const text = JSON.stringify(user);
console.log(text);

const copy = JSON.parse(text);
console.log(copy.name);
console.log(JSON.stringify(user, null, 2));

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.

This object is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee