Web Designers Journal

Visions Connected To The Web

By

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:

Read More...



By

JSON Object

JSON, or JavaScript Object Notation, has become a popular alternative to XML for defining structured data using JavaScript. A sample JSON definition that stores some information about Bob may look like the following:

{
“name”: “Bob Miller”,
“age”: 27,
“occupation”: “Programmer”,
“contact”:{
“address”: “253 Johnson Road”,
“Home_Phone”: “544-6443”,
“Cell_Phone”: “563-3566”
}
}

Read More...