JavaScript JSON.parse() method

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

ChromeYes
Safari4
Firefox3.5
Opera10.5

JavaScript JSON.parse() method Examples

Example 1

Let's see a simple example to parse an object.

Test it Now

Output:

ASHU BHATI

Example 2

Let's see an example to parse a particular attribute.

Test it Now

Output:

7

Example 3

Let's see an example to parse an array of attributes.

Test it Now

Output:

C++, JavaScript, Python, HTML
Next TopicJavaScript JSON




Latest Courses