Introduction to JSON

JSON (JavaScript Object Notation) is a lightweight data-interexchange format. Prior to JSON, XML was the most commonly used data inter-exchange format. XML still has its dominance. But JSON is also gaining up because of its simplicity. JSON represents the data as string:value pairs, where the value can be string, numbers, arrays, boolean values or even null value.

Take for example

1. string: number

{
 "rollnumber": 1
}

2. string: string

{
 "sitename": "programming"
}

3. string: boolean value

{
 "student" : true
}

4. string: array

[js]
{
"tags" : [
"cpp",
"c",
"PHP"
]
}
[/js]

5. string:object (Note that object is nothing but any of the four representations shown above)

[js]
{
"site": {
"sitename": "programming",
"tags": [
"cpp",
"c",
"PHP"
]
}
}
[/js]

You can learn more about these representations.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s