blog

Home / DeveloperSection / Blogs / Introduction of JSON

Introduction of JSON

Anchal Kesharwani2958 20-Sep-2014

In this blog, I’m explaining the concept of JSON. The JSON is the Java Script Object Notation that is used storing and exchanging the data. 

What is JSON?

JSON is the JavaScript Object Notation. It is used for data store and interchange. It is very lightweight that is text based open standard human readable data exchange. It is basically used for the data exchanging.

It is driven by the JavaScript scripting language. JSON is the language for the data formatting. The JSON used many server side languages like ASP, PHP, Perl, Python, Ruby, JSP, etc.

JSON is alternatively as XML. It is easier to use from XML.

The JSON Example for three student record:

{“students”: [{“name”:”Ajay Mishra”, “age”:20, “address”:”Allahabad","phone":"555 1234568"},{“name”:”Satish Kumar”, “age”:21, “address”:”Allahabad","phone":"555 1234569"},{“name”:”Ajay Mishra”, “age”:22, “address”:”Allahabad","phone":"555 1234560"}]}

This define in the XML:

 

<students>

<student>

<name>Ajay Mishra</name>

<age>20</age>

<address>Allahabad</address>

<phone>555 1234568</phone>

</student>

<student>

<name>Satish Kumar</name>

<age>21</age>

<address>Allahabad</address>

<phone>555 1234569</phone>

</student>

<student>

<name>Manoj Kumar</name>

<age>22</age>

<address>Allahabad</address>

<phone>555 1234560</phone>

</student>

</students>

JSON uses JavaScript syntax, but the JSON format is text only, just like XML. Text can be read and used as a data format by any programming language. 

Similarity in JSON and XML

There are following similarity in the JSON and the XML:

·         JSON and XML both support the plain text.

·         Both contain self-describing text data.

·         Both serve as a serialization format for objects.

·         JSON and XML both can be fetched with an HttpRequest. 

Difference between JSON and XML

There are following key feature that different from the XML and JSON:

·         JSON does not support end tag.

·         JSON is easier than XML to read and write.

·         JSON is shorter in comparison of XML.

·         JSON can use the arrays and XML use the parent tags. 

Why use JSON?

We should use the JSON for many reasons and purposes:

·    JSON provide the clean data that give the object oriented programming.

·    JSON provide the efficiency for the code. If you use the Ajax to show dynamic data then it is easier with the JSON.

·    JSON provide the scalability if your server side outputting the standard data format then it is easier to change and expand your application.

 

In this blog, I’m explaining what is JSON and why use it and also how different with the XML.

I hope this blog is helpful for you. Thanks!


Updated 20-Sep-2014

Leave Comment

Comments

Liked By