JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML.
3. JSON Syntax - Rules
JSON syntax is derived from JavaScript object notation
syntax:
● Data is in name/value pairs
● Data is separated by commas
● Curly braces hold objects
● Square brackets hold arrays
4. JSON Data - A Name and a Value
JSON data is written as name/value pairs.
A name/value pair consists of a field name (in double quotes),
followed by a colon, followed by a value:
Example :-
"firstName":"Napendra"
5. JSON Objects
JSON objects are written inside curly braces.
Example :-
{"firstName":"Napendra", "lastName":"Singh"}
6. JSON Arrays
JSON arrays are written inside square brackets.
Example :-
"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter","lastName":"Jones"}
]
7. JSON Files
● The file type for JSON files is ".json"
● The MIME type for JSON text is "application/json"