Java JSON tutorial

In this post,We will see introduction to JSON

Java JSON Tutorial Content:

What is JSON?

JSON stands for JavaScript Object Notation.It  is a simple and easy to read and write data exchange format just like XML.JSON is smaller than XML, and faster and easier to parse.

It is entirely language independent and can be used with most of the modern programming languages.

Internet media type of JSON is “application/json”.

JSON sample:

The above sample store informatipn about two countries.Basically

  1. Squiggly brackets({ }) act as containers
  2. Square brackets([ ]) represents arrays.
  3. Names and values are separated by a colon(:).
  4. Array elements are separated by commas

Comparison with XML:

As JSON and XML both are data exchange format.There is always comparison between them.
Similarity:
  • Both are human readable.
  • Both are hierarchical. (i.e. You can have values within values.)
  • Both are used by most of programming languages.
Differences:
  • JSON is less verbose so it’s definitely quicker for humans to write, and probably quicker for us to read.
  • JSON stores data in form of Key-value pair which is universal in nature.
  • JSON is faster than XML.
  • JSON can be parsed trivially using the eval() procedure in JavaScript

Was this post helpful?

Leave a Reply

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