Using JSON to exchange and parse data over a network.
JSON format is mostly used for serialization and transmitting structured data using Ajax.
The JSON syntax is used to represent three types of values:
Objects : Ordered datatypes such as key-value pairs are represented by objects. Values may be primitive or complex in nature.
Arrays : An array is used to represent an ordered list of values which can be accessed using a numeric index value. The values can be of any type, simple values , objects and sometime even other arrays.
JSON has no variables, functions or object instances, it used to represent only structured data.
JSON can represent all types of simple values, it can be used to represent numbers , strings boolean etc.
Example: JSON Syntax Simple Values.
In JSON, objects are represented using a slightly different object literal notation, it uses a quoted property format.
- There is no variable declaration.
- There is no trailing semicolon at the end of declaration.
You can also use complex objects, i.e objects within objects. But names in JSON must always be double-quoted.
Arrays and object can be used together in order to represent more complex data collections.