JSON is a format for storing and transporting data.
JSON is often used when data is sent from a server to a web page.
What is JSON?
JSON is a lightweight data interchange format
JSON is language independent *
JSON is “self-describing” and easy to understand
JSON Syntax Rules
Data is in name/value pairs
Data is separated by commas
Curly braces hold objects
Square brackets hold arrays
JSON Data – A Name and a Value
A name/value pair consists of a field name (in double quotes), followed by a colon, followed by a value:
JSON objects are written inside curly braces.
JSON arrays are written inside square brackets.
In the example above, the object “employees” is an array. It contains three objects.
Each object is a record of a person (with a first name and a last name).
A common use of JSON is to read data from a web server, and display the data in a web page.
For simplicity, this can be demonstrated using a string as input.