JSON ( JavaScript Object Notation ) is a lightweight text-based language. The data can only be text while it is being exchanged between a browser and a server. Any JavaScript object can be converted into a JSON text.
JSON supports these two data structures:
A JSON can store several types of values, listed in the table below:
Values | Description |
---|---|
String | In JSON, strings are enclosed in double quotes and there are many special characters like b (backspace), t (tab), etc. |
Number | JSON supports different number types like integer, fraction and exponential. |
Boolean | In JSON, true or false value can also be assigned. |
Null | In JSON, an empty value can be assigned. |
Here, key-value pairs are always placed between curly brackets ({ }). If there is more than one key-value pair, they are separated by commas.
Here, values are enclosed in square brackets ([ ])and each value is separated by a comma…
{"Students" : [{"name" : "Aaron","subject" : "Data structures","age" : 19},{"name" : "Beck","subject" : "Algorithms","age" : 23},{"name" : "David","subject" : "Machine Learning","age" : 28}]}
Note that in the above code snippet, there is an array of
Students
objects.