Friday 14 November 2014

JSON Syntax

JSON Data represented in key-value pair. JSON object can be String | Number | Object | Array | TRUE | FALSE | NULL.

{
    "name": "Gopi",
    "age": 26,
    "Profession": "Software Engineer",
    "salary": 40000,
    "permanentEmployee": true
}


Basic Components of JSON
There are two basic components in JSON
        1. Objects
        2. Arrays

Objects
Objects are represented by curly braces.

{
    "name": "Krishna",
    "id": 1,
    "marks": {
        "Physics": 85,
        "Chemistry": 60,
        "Mathemaics": 90
    }
}


Arrays
Arrays are represened by square brackets, separated by comma.
{
    "book": [
        {
            "id": "01",
            "language": "Java",
            "edition": "third",
            "author": "Herbert Schildt"
        },
        {
            "id": "07",
            "language": "C++",
            "edition": "second",
            "author": "Kanetkar"
        }
    ]
}


 

Prevoius                                                 Next                                                 Home

No comments:

Post a Comment