All syntax of JSON is same like JavaScript syntax. JSON syntax is derived from JavaScript object notation syntax
  • In JSON data is write in name/value pairs.
  • Every data in JSON is separated by commas.
  • Curly braces are used for store objects.
  • Square brackets are used for store arrays.

JSON data - Name and a Value

In JSON data is write in name/value pairs, every name is written in double quotes " " and each data is separated by commas.



JSON Objects

JSON objects are written inside the curly braces { }. Same like JavaScript JSON objects can contain multiple name/values pairs:


{"firstName":"Komal", "lastName":"Pandit"}

JSON Arrays

JSON arrays are written inside square brackets [ ]. Same like JavaScript, a JSON array can contain multiple objects:


{"firstName":"Komal", "lastName":"Pandit"},
{"firstName":"Gaurav", "lastName":"Rawat"},
{"firstName":"Hitesh", "lastName":"Kumar"}
In above example employee is an array object which contain three objects.