To parse a JSON in JavaScript, we can make use of the built-in JSON.parse()
method, which takes a JSON string and returns a JavaScript object. Here's how you can parse the provided JSON in JavaScript:
171 chars4 lines
The above code will output below JS object:
430 chars25 lines
Here, we are first using JSON.parse()
to convert the JSON string into a JavaScript object. Then, we are logging the object to the console to verify if it has been parsed correctly.
gistlibby LogSnag