JSON has two structure

1. Collection of key(name)/value pairs

Syntax:

{ key1: value1, key2 : value2,......}

Here key must be String(text) ,which must be double quoted.

Example: {"age":25, "dept":"sales"}

2.List of values

Syntax:

[value1, value2, value3,....]

Example:

1.[1,2,3,4]

Only numbers.

2.["fruits","sea food","meats"]

Only text.

3.[ "fruits","sea food","meats",2,45.6,true]

Combination of numbers,text and literals.

 

Supported data type for values:
  • string - Must be in double quote
  • number - 0 to 9
  • object - must be placed inside { }
  • array - must be place inside [ ]
  • true
  • false
  • null