The Javascript JSON.parse() method is used to transform a JSON string into a JavaScript object.
Syntax:
JSON.parse(text)
Parameters
text: It represents the string to be parsed as JSON.
Return
JSON object.
Example:
<!DOCTYPE html> <html> <body> <script> var details = '{ "Name":"JAI", "Seat":"56", "Coach":"5A"}'; var passenger = JSON.parse(details); document.write(passenger.Name + " " + passenger.Seat); </script> </body> </html>