JavaScript JSON parse() Method
JavaScript JSON parse() Method
The JSON.parse() method is used for parsing a string and returns a JavaScript object. The string must be present in JSON format. We can optionally transform the result with a function as this method allow us to do so.
Syntax:-
Its syntax is:- JSON.parse(string, function)
Return:-
Its return is:- JSON Object/Array
Further Explanation:-
Parameter | Description |
---|---|
string | Required. A string present in JSON format |
reviver function | Optional. A function that can be used to transform the result. The function is called for each item. |