Which method parses a JSON string into a JavaScript object?

The story behind the answer

JSON.parse() parses a JSON string into a JavaScript value, commonly a JavaScript object or array. For example, JSON.parse('{"name":"Ada"}') produces an object with a name property.

The method belongs to JavaScript's built-in JSON object, which provides tools for exchanging structured data. JSON was designed as a lightweight, text-based format for communication between browsers and servers, and its syntax was derived from a subset of JavaScript.

A frequent mix-up is JSON.stringify(), which performs the reverse operation: it converts a JavaScript value into a JSON string. parseInt() is for interpreting an integer from text, not for reading structured JSON. eval() can execute JavaScript source code, but it is unsafe and does not provide the strict JSON-focused behavior of JSON.parse(). Invalid JSON generally causes JSON.parse() to throw a SyntaxError.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: