JSON is javascript object notation, and it is a data interchange format to send and receive data from server to client(Website, software).
JSON uses is text only, so it is light weight data interchange format and easier to process and understand. In JSON any data type like string, numbers, decimal, boolean, array, objects can be used.
JSON Syntax
{ "name":"value" }
- JSON data is represented as name and value pair separated by colon.
- multiple name value pair is seprated by comma
- name-values are enclosed in curly braces.
- object should in curly braces and arrays in square brackets.
JSON example
{ "programming":"javascript", "age": 24}
JSON Objects
JSON objects are enclosed in curly braces {},multiple object can be used in JSON.
"car":{
{"company":"Maruti", "color": "black"},
{"company":"Skoda", "color": "Silver"}
}
JSON Arrays
"car":{
"company":["Honda","Maruti","BMW","Range Rover"]
}
JSON Array of Objects
"myjson"={
"car":[
{"company":"Maruti", "color": "black"},
{"company":"Skoda", "color": "Silver"}
]
}