Network data serialization
Exchange structured data between a JavaScript application and a server.
JavaScript · Module
The global JSON namespace provides static methods for parsing JSON text and converting JavaScript values to JSON. It is not a constructor; use methods such as JSON.parse() and JSON.stringify().
The global JSON namespace provides static methods for converting between JavaScript values and JSON text. Use JSON.stringify() to serialize supported values and JSON.parse() to construct a value from valid JSON text; JSON is a namespace object, not a constructor.
JSON.parse(text, reviver)
JSON.stringify(value, replacer, space)
JSON.isRawJSON(value)
JSON.rawJSON(rawJSON)The JSON namespace object; its static methods return method-specific parsed values, JSON strings, or raw JSON objects.
const text = JSON.stringify({ answer: 42 });
const value = JSON.parse(text);
console.log(value.answer);This serializes a JavaScript object to JSON text, then parses that text back into a JavaScript value.
Exchange structured data between a JavaScript application and a server.
Persist application state in local storage or a file.
Convert external JSON text into usable JavaScript values.
Create readable or filtered JSON output for logs and APIs.
JSON.parse()JSON.stringify()JSON.isRawJSON()JSON.rawJSON()