JSON Syntax

Advertisements

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

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements