What is the File Extension JSON ?

JSON is a lightweight, language independent "data " interchange format. It was derived from ECMAScript programming language standard. The MIME content type for it is application/json.
The file extension for it is .json. JSON defines a small set of formatting or rules for portable or language independent representation of data. JSON can represent four primitive types namely string, number, boolean, null and it can also be used to represent two structured types namely objects and arrays.

An object is a name-value pair similar to the dictionary data type in python where the name is a string and value can be string, number, null or boolean, object or array.
For example
:- A car can be represented in an object representation as;-
"cars":{"model":"2006", "manufacturer":"Audi","price":"20000 USD"} .
An array on the other hand is an ordered collection of similar data items.

JSON was designed to be minimal, portable and as a subset of Javascript. The JSON text is encoded in Unicode and default encoding is UTF-8. The code for generating JSON text from the XML representaion is available for programming languages like java, python, php.

The File Extension JSON is readily recognized and the JSON data is easily consumed by a simple javascript based script because it does not have to do any additional parsing. The following code snippet shows how you can use it to represent data with utmost ease.


{
"customers" : {
"customer" : {
"@attributes" : {
"id" : "2314"
},
"name" : "Raman deep",
"phone" : "9967345612",
"purchases": "30000 USD"
"address" : {
"street" : "23/25 Rajouri garden",
"city" : "New Delhi",
"state" : "Delhi",
"zip_code" : "654321"
}
}
}
}


whereas its xml representation is shown below and as can be seen by comparing these two representations that the former one is easy to parse as it uses javascript object and array data types to represent data and hence is used more nowadays.


<customer>
<customer id="2314">
<name>Raman deep</name>
<phone>9967345612</phone>
<purchases>30000 USD <purchases>
<address>
<street>23/25 Rajouri Garden</street>
<city>New Delhi</city>
<state>Delhi</state>
<zipcode>654321</zipcode>
</address>
</contact>
</contacts>


I hope this tutorial was brief and concise representation of the File Extension JSON .