Javatpoint Logo
Javatpoint Logo

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

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.

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




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials