JSON means JavaScript Object Notation. It is an open source text base standard for data exchange. Primary usage of JSON is to transmit data between web browsers and servers as alternative of XML.

Syntax rules

  • Data is a key-value pair (also reffered to as property) separated by a comma. Keys are always strings.
  • Curly brackets hold objects
  • Square brackets hold arrays

Data types

  • String
  • Object
  • Number
  • Array
  • Boolean

Example

{
    "example_string":"This is string",
    "example_date":"2018-12-12 00:00:00",
    "example_number:1,
    "example_number2":3.65,
    "example_boolean":true,
    "example_array":["element1","element2"],
    "example_object":{
        "property1":"data1",
        "property2":data2"
    },
    "example_null":null
}

In the example above you can see a JSON object with properties of different types. Important to note is that the date is presented as a string and not as different data type.

Was this article helpful?