JavaScript Object Notation

JavaScript Object Notation (JSON) is a way of creating an object in JavaScript with its properties initialized to specified values. A comma-separated list of key:value pairs is enclosed in braces, as shown in the following JSON example.

var person = {name:"Harry", age:17};

Do not leave a trailing comma after the last key:value pair in your JSON, as some Web browsers may not behave correctly.

An object is created with properties name and age, which are initialized to "Harry" and 17, respectively. It is equivalent to the following JavaScript code.

var person = new Object();
person.name = "Harry";
person.age = 17;

JSON notation helps in making JavaScript code simpler and easier to read.