JSON (JavaScript Object Notation) is an open standard format that uses text to transmit data objects consisting of attribute-value pairs.

 

JSON has been increasingly used to replace XML.

 

Example

 

{

    "firstName": "Michael",

    "lastName": "Salzlechner",

    "age": 45,

    "address": {

        "streetAddress": "3340 SE Federal HWY 269",

        "city": "Stuart",

    }

    "phoneNumbers": [

        {

            "type": "work",

            "number": "561-329-2598"

        },

        {

            "type": "home",

            "number": "111-222-3333"

        }

    ],

    "children", ["Lauren"],

}

 

JSON data consists of a root object (the outside curly braces) that can contain JSON objects, arrays and values

 

here is an empty JSON object

 

{

}

 

now a JSON object containing a simple string value

 

{

    "firstName": "Michael"

}
 

the object above contains a property named 'firstName' and the property contains a string value of "Michael"

 

another JSON object containing a simple array

 

{

    [

        "Value1",

        "Value2",

        "Value3"

    ]

}

 

you can see a JSON object. then inside you can see the square brackets. these are the sign for an array. inside the JSON array you have items (in the case of an array items do not have a name) and each item can again be a JSON object, a simple value or another array