What is JSON?
JSON is a standard format for storing and exchanging data. This format is easy to understand and write. JSON is text, and we can convert any JavaScript object into JSON and vice versa. JSON format is language-independent. The JSON files can be named with extension .json.
JSON Syntax
A JSON object is enclosed inside curly brackets. Data is represented as key-value pairs separated by commas. Object data is represented inside curly brackets. Array data is represented inside square brackets.
eg. {“name” : “Nancy”, “age”: 50, “gender”: “female”}
JSON data types
Out of key-value pair, key can be string, number, or identifier names. The value can be of data types such as
- string
- number
- object (JSON object)
- array
- boolean
- null