JSON Team Howard
What is JSON?
JSON Advantages - Why Is It Used
- It is very simple code and is very legible for humans. This makes it easy to implement and allows for frictionless mapping.
- It is a common data format and has a diverse range of functionality
- It is in many languages and is in almost apart of every major coding language
- Can be used to transmit data between a server and web application
- It can easily be transferred between computers
- The data is in name/value pairs and are grouped by a colon and separated by a comma
- Curly braces hold objects
- Square brackets hold arrays
- Property names must be within quotations
- The trailing commas and leading zeros in a number are prohibited
This picture is an example of the JSON format. The first thing we see is a bracket, this marks the start of a JSON object. Everything inside the brackets is considered an object. Inside the object, we see many Key values. The “firstName,” “lastName,” and “major” are examples of Keys in this picture. They are identified by a string of letters and can hold all types of data, in this case they only stored Strings. Each Key is separated by a comma. The Keys can store their own objects by opening brackets after the colon. This picture also has an Array, which would be “students.” You can assign an Array by adding the square brackets after initializing it. In this picture, the Array has three other JSON objects inside of it, separated by a comma. It’s inside these objects, inside the Array, that the other information is stored.
Relates to REST API because it can be used in transferring data from server to user, and is probably used in REST API’s Created/Specified by Douglas Crockford in the early 2000’s It is string with a specific format- it only contains properties, no methods Can’t misplaced commas it is easy to make small errors