JSON overview

Connect with

JSON is programming language and platform independent data structure data format to exchange the data between heterogeneous system. JSON is widely used nowadays by almost all the language by all the developers whether its web application or enterprise application or database.

1. Overview of JSON

JSON (Java Script Object Notation) is simple structured text format for data exchange. JSON is a plateform and programming languge independent data format. It is used to handshake the data between two different applications whether its Web Application or enterprise application and storage of data too. JSON is very popular data format nowadays and used by almost every language extensively. JSON is light weight in terms of size and parser too.

Why I said its light weight just beacuase of size of json if you campare from XMl. There are lot of libraries available in the industry, however, you can use proven libraris like Google’s Gson and Jackson parser which is bieng widely used in the industry nowadays and this is very flixible.

Few of the NOSQL document based data bases uses extensively JSON as storage and querieng too like mongoDB. Messaging framework Kafka extensively used JSON in its framework. A lot of JS framework too where you can find extensive use of JSON, JS framework as: Angular JS, JQuery etc.

2. Significant of JSOn

JSON is being used to exhange the data between two different system/application. in any RestFul API we write the json content as “appplication/json“. Douglas Crokfort came up with idea of JSON, now used as international data exchange format.

3. What is need of JSON

Let us understand this in simple term. Your architecture is divided in multiple tiers: UI (in Angular ), middle layer in Java and database in NoSQL mongoDB. In the middle layer , a lot of API exposed for different services which UI layer consumed it. In this way you are saying that, your UI and middle layer API layer completely decouple each other. You take data from database process the data and build a response and throw a json which understand by any language whether its java, .net, python, php or something else.

In nutshell, you can say , JSON is programming language independent data format, which can be understand by any programming language. JSON data can be exchanged between two hetrogenious systems. It means, in client and server model, client developed in one programming language and middleware server can be developed in another programming language and database can be developed in some another programming language.

for example: JSON to Java: deserialization or consumption of json in Java programming language is very easy to include your familiar library like Google’s Gson. Java to JSON: serialization or production of json in Java programming language is very easy to include your familiar library like Google’s Gson.

Similarly, across the industry, there is multi tier architecture to and from JSON. when different system collaborate each other via common json format, developer or user has wonderful experience of using JSON data format.

4. JSON Data Format

A valid JSON format is as bellow:

  1. a valid JSON document is surrounded by curly braces i.e. “{}”
  2. two key-value pairs are separated by comma i.e. “,”
  3. key-values are separated by colon symbol i.e. “:”
  4. arrays are surrounded by square bracket i.e. “[]”
  5. within the square bracket data can be any one of them as: string, key-value paires, object, nested arrays
  6. there is no limit of nested object one within the another

Sample format of JSON: This is the json fomat which include arrays, object, key-value pairs:

{   persons: [     
      "name": "Anuj", 
     "address": {"city": "New Delhi", "country": "India"} 

5. JSON data type

On high level you can find following JSON data type.

  1. String: its a varchar data type like SQL
  2. Number: it can be integer, double or fraction
  3. Boolean: either true or false
  4. Null: to store null value in perticular node.

6. JSON Structure

On high level, JSON structure can have any one of the following:

  1. Key-Value pairs: its simple data type of key value pairs, in which key is always string and value can be String, number , boolean, null or any another nested object.
  2. Object: Object is surrounded by curly braces and within curly braces simple key-value pairs or another object or array can be.
  3. Arrays: arrays is surrounded by square brakcet i.e. [] , within the square bracke there must be either an object or key-value pairs

Valid JSON document as:

 "id": 1,
 "name": {"firstName":"ranjeet", "lastName": "Jha"},
 "qualificaiton": ["M.Tech", "MBA"],
 "location": "New Delhi, India",
 "socialContact": [{"linkedIn": :"https://www.linkedin.com/in/jharanjeet/", "googlePlus": ""} ]

7. Reference



you came here it means you like this post, Happy learning, keep growing and keep sharing.

Connect with

3 thoughts on “JSON overview

Leave a Reply

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