home

Json Object

Its sound repeated by always saying that object holds key/value pair. Each key is represented as a string in JSON and value can be of any thing number or text any type.


The curly brace { represents JSON object.

In the below example, we have JSON Object (Car is an object), which is contained with Key/Value pairs (model/BMW, price/80-lakh).

And we have String, Number and Boolean value for the keys inside the Car object.

Please have look into below json object example code.

{  
    "Car": {  
        "model":       "BMW",   
        "price":      80-lakh,   
        "color":      "blue",   
        "Year-of-release":      "2006",   
    }  
}  

JSON Object with Strings

JSON Object with Strings, string values must be inside of double quotes.

{  
        "name":       "Jhon Km",   
        "email":      jkm@gmail.com,   
        "country":      "United States"
    }  

JSON Object with Numbers

Let’s go with below example code of object with numbers.

{  
        "integer":       14,   
        "fraction":     .0056745,   
        "exponent":      1.61309e+0 
    }  

JSON Object with Booleans

Let’s go with below example of Booleans code.

{  
        "first":       true,   
        "second":     false
    }