Tag Archives: JSON with java Script

JSON Overview

JSON (JavaScript Object Notation) is a lightweight, language-independent, text-based data storage and data-interchange format to sharing between systems.

Below are some properties make JSON an ideal data-interchange language:

  • JSON is “self-describing” and easy for humans to read and write.
  • JSON is text, written with JavaScript object notation.
  • JSON represent values in form of key/value pairs.
  • JSON is easy for API’s to parse and generate.
  • JSON is a text format that is supported by many languages because of language-independent

Points to remember

The JSON file extension is “.json”
The JSON text MIME type is “application/json”.

Why use JSON?

There are so many reasons to use JSON:

  1. JSON represents values in form of key/value pairs which is easy to understand and supported by most programming languages For Ex: C, C++, C#, Java, JavaScript, Perl, Python, and many others.
  2. The JSON format is text, it can easily exchange browser to and from a server,
  3. Current enterprise application uses JSON for communications to the server with REST services, Communication to the server with Ajax call, convert Javascript object to JSON or vice versa.
  4. JSON extensively used by NoSQL database to store records as JSON documents. For Ex: MongoDB, Oracle NoSQL Database, and Oracle Berkeley DB.
  5. Traditional relational databases constantly gaining more JSON capabilities like PostgreSQL, Oracle, etc. supports JSON data for certain features such as transactions, indexing, declarative querying, and views.

JSON Example

You can refer below JSON  object to represent Student Detail. Corresponding is a description of the representation of each field in JSON with respect to the data type.

JSON Data Type & Syntax

Student JSON Object

Above JSON is generated with respect to below Student JAVA object. You can follow below link to know about JSON supported Data Type and Syntax.

Student Java Object

The same Student and JSON object will refer in the subsequent example related to JAVA for more JSON + JAVA handling example.


Below is the list of the library that developed by java open source community to handle (JAVA +JSON) development.

  • GSON
  • Boon
  • JSON.org

Follow below link to know in-depth knowledge of JSON parsers and in which case should be used specifically.

JSON Parsers

You would like to see

Follow below link to learn more on JSON and  JSON issues solutions:


JSON Parsers

JSON (JavaScript Object Notation) is most popular for NoSQL data storage, data exchange format between browsers and web servers and latest framework also use for communication over networks.

For Example :

  • All latest browsers natively support parse JSON data to java script to display over page.
  • REST Service support one of MediaType is JSON to exchange data between browsers or client application to servers where these REST Services are deploy.
  • Some latest framework like Elasticsearch, Logstash, Kibana, Kafka ,Filebeat etc. are used JSON for internal storage and data exchange over network between servers.

All these above cases, JSON data language independent feature provides communication compatibility between different type frameworks and servers. All these frameworks and servers implemented by one of computer language which provides JSON API’s by internally or consumed third party library for parsing and generation.

Here we will focus mainly on Java based JSON APIs which provide various choices for parsing and JSON generation on different cases from JAVA objects.

The Java Open Source Community developed some JSON APIs which offers more choices and flexibility to work with JSON. Here is list of some well-known JSON APIS:

  • Jackson
  • GSON
  • Boon
  • JSON.org

See also : Serialization and Deserialization of JSON to/from JAVA.


Jackson is most popular Java JSON APIs which provide several choices to work with JSON. It contains two different parsers:

  • JsonParser : This is pull parser, which parse one token at a time. These token generated by JsonGenerator.
  • JsonMapper : This parser is use convert customize JSON to/from JAVA object. It also parse data in tree model.

You can follow this link to more detail about Jackson JSON APIs : https://github.com/FasterXML/jackson


GSON provides flexible Java JSON API developed by Google. GSON APIs are able to work with arbitrary Java objects including pre-existing objects that you do not have source code. It also supports for handling complex objects with generics and deep inheritance. GSON is having three different parsers for JSON Java APIS:

  • Gson class : It can parse JSON into custom Java objects.
  • JsonReador : It’s pull JSON parser, which parse one token at a time.
  • JsonParser : It’s parser JSON into a tree structure of GSON specific Java Objects.

You can follow this link to more detail about GSON JSON APIs : https://github.com/google/gson


Boon is a standard JSON API in Groovy . It is similar to JACKSON but not only apecific for Java JSON API. It’s complete tool kit to working with data, file process and REST services etc. Boon contains the following Java JSON parsers:

  • ObjectMapper :This parser is use to parse JSON into custom objects and Java Maps.

You can follow this link to more detail about BOON JSON APIs : https://github.com/boonproject/boon


JSON.org provides the first JSON API developed for Java. It’s easy to use but not flexible and fast as compared to others  Java JSON open source APIs.

As I recommend if your application is too old and using this API then only go with it otherwise you can switch with others above Java JSON APIs.

You can follow this link to more detail about JSON.org JSON APIs : https://github.com/douglascrockford/JSON-java

Here, In my further posts for JSON I will focus on JACKSON and GSON because that are most known JSON APIs used by developers.

You would like to see

Follow below link to see more about JSON Tutorial and JSON issues Solutions: