How to create a JSON Object

An object is an unordered set of name/value pairs. An object begins with { (left brace) and ends with } (right brace). Each name is followed by : (colon) and the name/value pairs are separated by , (comma).
object_json

Note:- JSON values can be any JSON data type: string, number,boolean, object, array, null.

How to access JSON Object Values?
Object values can be accessed like an array using an index, using the property name in quotes, or by following the object’s variable name with a period and the property name.
Example:-
[php]
<script type="text/javascript">
var empObject = {
"name": "John",
"age": 27
};
</script>[/php]

Access name and age value with array notation
[php]
<script type="text/javascript">
document.write(empObject[‘name’]);
document.write(empObject[‘age’]);
</script>[/php]
Output:- John 27

Access name and age value with dot notation
[php]
<script type="text/javascript">
document.write(empObject.name);
document.write(empObject.age);
</script>
[/php]
Output:- John 27

Note:- Property value may be override, if you define the value of property again.
[php]
<script type="text/javascript">
empObject.name="Tony";
document.write(empObject.name);
</script>[/php]
//Output:- Tony