JSON full form is JavaScript Object Notation. Basically JSON used to transfer data from web server to client side or client side to server side.

This is light-weight and readable data format. and best alternate of xml. Below snippet show you JSON data:

{"name":"The It Bulls","age":35}

There are two main part of JSON Object i.e. key and pair, key always defined with quotes and value may be different-different like String, int, long JSONObject it-self or JSON Array too...

Let's take an example of JSONObject that contains student data and having four student data as JSONArray:

{
    "school": "Child Care School",
    ...
    "students": [
          {"name": "Albart Pinto", "roll-no": 46, "section": "A"},
          {"name": "John", "roll-no": 12, "section": "A"},
          {"name": "Ammy", "roll-no": 49, "section": "A"},
          ...
    ]
    ...
}

In above JSON data we create student data which contain three student records as JSONArray and school name.

JSON Creation Rules
  • Json must contains key/value format data, key must be in quotes
  • Each data separated by comma i.e. ','
  • Culy brackets hold object like {...}
  • Square brakcets hold array object

JSON Data Types

  • String simple text
  • Boolean true or false
  • Number
  • JSONObject
  • JSONArray