JSON Syntax


Prev Tutorial Next Tutorial

JSON Syntax

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.

Example

"firstName":"Komal"

JSON Objects

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

Example

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

JSON Arrays

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

Example

"employees":[
{"firstName":"Komal", "lastName":"Pandit"},
{"firstName":"Gaurav", "lastName":"Rawat"},
{"firstName":"Hitesh", "lastName":"Kumar"}
]

In above example employee is an array object which contain three objects.


Prev Tutorial Next Tutorial

Advertisements




Download Projects

Advertisements

FREE Online Google Play APK Downloader

Buy APP Installs, Buy 100% Genuine Installs