JSON

JavaScript Object Notation (JSON) is a lightweight data format that is based on how JavaScript represents objects. It is officially defined in RFC 4627.

An object is the simplest entity in JSON, and the following snippet is an example:

{ 
   "name": "Taj", 
   "city": "New York", 
           "no_rooms": 3 
} 

It has three fields with specific values. The field names are always strings, while the values can be of different types such as integer, float, string, and so on.

JSON also has the concept of arrays. So a hotel chain can be described as follows:

{ "chain": [{ 
         "name": "Taj", 
         "city": "New York", 
                  "no_rooms": 3 
          }, 
          { 
          "name": "Leela", 
          "city": "New Jersey", 
                   "no_rooms": 5 
           } 
] 
} 

Like XML, JSON is self-describing and hierarchical, and can be parsed into an object at runtime. There is a standard for schema definition called JSON Schema, but it is not as widely used as XSDs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset