Converting a JSON Text to a JavaScript Object

One of the most common use of JSON is to fetch JSON data from a web server (as a file or as an HttpRequest), convert the JSON data to a JavaScript object, and then use the data in a web page.

For simplicity, this can be demonstrated by using a string as input (instead of a file).

JSON Example – Object From String

Create a JavaScript string containing JSON syntax: