JSON.Parse() is javascript method for parsing JSON which converts to JavaScript objects.
Here is the Syntax
- JSON.parse(text)
- JSON.parse(text, reviver)
Example
let jsObj = JSON.parse('{"name":"Geico", "founded":1936, "country":"United States"}'); JSON.parse() method compatible in all browsers including IE 10.
Reviver method object can be passed in JSON.parse() to return a modified object of JSON in case of custom logic requires to add and return the different values as JS object.
SyntaxError exception is thrown when JSON data is not based on specification.