JavaScript Object Notation
Used as a lightweight data sharing format in between server and web application, and also in between web applications.
- This is called as fat-free version of XML :D.
- Easy read / write format.
- A collection of “key” : “value” pairs.
- This can be represented as object, dictionary, hash table, keyed list or associated arrays.
- Key and value are separated by colon “:”
- JSON file extension is .json
As compare to XML, json
- Don’t have tags, but have hierarchy structure with some easy notations.
- Can’t use javascript keywords as names.
- Can be parsed easily.
Notations
Key can be of any name [String] enclosed in double quotes “”
Value can be represented as any one of the following data type like Associated arrays enclosed in square brackets []
either key : value pairs or only values separated by comma “,” can be from any one of the
- Collection [array/list/map]
- Boolean [true / false]
- Number [Int]
- Object
- String [Plain text]
Sample json –
{ "qavalidation.com": [ { "Course": "Selenium", "Category": [ "youtube", "blog" ], "isWeb": true }, { "Course": "Appium", "Category": [ "youtube", "blog" ], "isWeb": false } ] }
JSON uses javascript, but any programming language can read json data as this is text only format.
JSON viewer:
- Download standalone from codeplex site..
- For online view, I found JSON viewer is interesting.
- There are even browser add-ons you can try.
- JSON syntax validator – https://jsonlint.com/
References:
For pictorial representation, refer official site http://www.json.org/
For more detailed explanation, refer http://www.w3schools.com/json