JSON

what is JSON?

  • json is a standard data format, that often use for the response data.
  • most of the time json data is come as a value pair and array data type.
  • there are three main parts to understand in json format.
    1. key value pairs
    2. json object
    3. json array

key value pairs

"first name" : "Samith"

A JSON Object

{
"firstName" : "samith",
"lastName" : "wijesinghe"
}

when key value pair is wrapped with curly brace it called json object

JSON Array

{
"names" : [
{
"firstName" : "samith",
"lastName" : "wijesinghe"
},
{
"firstName" : "hasini",
"lastName" : "wijesinghe"
}
]
}

if we put a square brackets around set of json objects it's called as a json array.

  • in a json value part can become a whole json object or json array.