JSON Object
JSON object holds key/value pair. Each key is represented as a string in JSON and value can be of any type. The keys and values are separated by colon. Each key/value pair is separated by comma.
The curly brace { represents JSON object.
Let’s see an example of JSON object.
In the above example, employee is an object in which “name”, “salary” and “married” are the key. In this example, there are string, number and boolean value for the keys.
JSON Object with Strings
The string value must be enclosed within double quote.
JSON Object with Numbers
JSON supports numbers in double precision floating-point format. The number can be digits (0-9), fractions (.33, .532 etc) and exponents (e, e+, e-,E, E+, E-).
JSON Object with Booleans
JSON also supports boolean values true or false.
JSON Nested Object Example
A JSON object can have another object also. Let’s see a simple example of JSON object having another object.