This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

JSON.parse

Summary

Parse a JSON string to a JavaScript object.

Method of apis/jsonapis/json

Syntax

var  = JSON.parse(json string);

Parameters

json string

Data-type
String

A JSON string.

Return Value

Returns an object of type

A JavaScript object representing the JSON string.

Examples

var json = '{"result":true,"count":1}',
    obj = JSON && JSON.parse(json)

Notes

This method will throw an error if the argument is not a valid JSON string. You should wrap the parse call in a try/catch block.

Related specifications

JSON-LD 1.0
W3C Recommendation