JSON.parse()
JavaScript JSON.parse() method
Last Updated : 17 Mar 2025
The JavaScript JSON.parse() takes a JSON string and transforms it into a JavaScript object.
Syntax
Parameters
text: The string to parse as JSON.
reviver: It is Optional. It prescribes how the value originally produced by parsing is transformed, before being returned.
Return value
An object corresponding to the given JSON text.
Browser Support
| Chrome | Yes |
| Safari | 4 |
| Firefox | 3.5 |
| Opera | 10.5 |
JavaScript JSON.parse() method Examples
Example 1
Let's see a simple example to parse an object.
Output:
Example 2
Let's see an example to parse a particular attribute.
Output:
Example 3
Let's see an example to parse an array of attributes.
Output:
C++, JavaScript, Python, HTML