JSON - Syntax


Let's have a quick look on JSON basic syntax. JSON syntax is basically considered as subset of JavaScript syntax, it includes the following:

  • Data is represented in name/value pairs

  • Curly braces hold objects and each name is followed by ':'(colon), the name/value pairs are separated by , (comma).

  • Square brackets hold arrays and values are separated by ,(comma).

Below is a simple example:

    "book": [
       "language": "Java",
       "edition": "third",
       "author": "Herbert Schildt"
       "language": "C++",
       "edition": "second",
       "author": "E.Balagurusamy"

JSON supports following two data structures:

  • Collection of name/value pairs: This Data Structure is supported by different programming language.

  • Ordered list of values: It includes array, list, vector or sequence etc.