Header Ad

Tuesday, April 3, 2012

Introduction to JSON


JSON( Java Script Object Notation) is a lightweight data interchange format. It is easy to parse and generate. JSON format is completely language independent. But uses conventions that is easy for programmers.

JSON is built on two structures:
  • A collection of name/value pairs.
  • An ordered list of values. Like an array, List, or sequence.

The following sample JSON format. We can easily retrieve the values of below JSON by using keys.
{
      "id": 1,
      "name": "John",
      "designation": "SE"
}

The following is the sample example for LIST of values.

{
  "employees":
  [
    {
      "id": 1,
      "name": "John",
      "designation": "SE"
    },
    {
      "id": 2,
      "name": "Smith",
      "designation": "SE"
    }
  ]
}

No comments: