MilesWeb
Leading Web Hosting Provider in India Since 2012.
Award-winning Web Hosting Company
Everything that you need to build, host and manage a website is available at just 99/mo

JSON – Everything That You Want To Know About It!

JavaScript Object Notation (JSON) is an open-standard file format, used to exchange information that is readable to humans. This file contains only text and uses the extension .json.
It is a lightweight format used for storing and transporting data between a server and web application, as an alternative to the XML. In simple words, JSON gives human-readable collection of data that we are able to access in a logical manner.

Usage of JSON –

Most of the developers use JSON so as to work with AJAX (Asynchronous JavaScript and XML). Both these formats work well together in order to provide you the asynchronous loading of stored data that simply means, the website can update its information without refreshing the page.
This format is often used to serialize and transmit structured data over a network connection.
It also allows users to request data from a different domain with the help of a method called as JSON by using (<script>)  tags. Without this, you cannot transfer data across-domains.

Structures of JSON –

JSON is built on two structures :

(i) A collection of name/value pairs. In most of the languages, this is known as an object, record, dictionary, struct, hash table, keyed list or an associate array.

(ii) An ordered list of values. In most of the languages, this is known as an array, vector, list, or sequence.

Related: Why Should You Shift Your Java Applications To MilesWeb PaaS Containers?

JSON syntax rules :

(i) Data is always in key/value pair.

(ii) Data is always separated by commas.

(iii) Curly braces hold objects.

(iv) Square brackets hold arrays.

Example : “gender” : “male”

Here:          key (name) = gender and

value = male

Different types of Values are :

(i) Array – Array of values

e.g :

Or

 

Note: Difference here is that, the key Hobby has several values (football, painting, swimming) mentioned in a square brackets, which represents an array.

(ii) Boolean – True or False

 

(iii) Number – An integer

 

(iv) Object – It is an associate array of key/value pairs 

 

(v) String – Several plain characters that usually form a word

 

Conclusion –

From the above examples, you might have understood that JSON is a useful tool that can be used to interchange data in a manner that can easily be understood by humans.

It can load information asynchronously so that, your website becomes more responsive and can handle the data stream more easily. Also, JSON is easy and lightweight than XML.

Leave a Reply

Your email address will not be published. Required fields are marked *