JSON short for JavaScript Object Notation is a lightweight data interchange format.This is something that simple for humans to read as well as easy for machines to parse through.If you would like an even more detailed information about JSON please visit http://www.json.org/.
A JSON object is an unordered container of name/value pairs something similar to an object literal.The key/value pairs are seperated by a semicolon(:) while the values pairs are seperated by a comma. A name can be any string. A value can be any JSON value.,which are STRINGS,NUMBERS,ARRAYS,OBJECTS,BOOLEAN and NULL. The beauty of such a simple structure is that it can be nested easily but please do note that the effectiveness of a JSON object is best acheived when it is flat.
Example :
{
"name" : "Sudheer",
"blog1" : "techno-helper",
"blog2" : "booksnme"
}
The JSON String is on the other hand an ordered container which has zero or more unicode characters wrapped in double quotes an using backslashes.This is similar to the String literals in 'JAVA' or 'C'
Example :
{
"name" : "Sudheer",
"mesage" : "\"Run\" I shouted at her",
"big-message" : "You can also write
these
in lines"
}
JSON numbers are like the numbers in Java or JavaScript and can be an integer, real, or scientific excluding octal and hexa format numbers, also a leading zero is also not accepted.
Example:
{
"day" : 9,
"month" : 11,
"year" : 2008
}
JSON array is an ordered collection of values. An array begins with [ (left bracket) and ends with ] (right bracket). Values are separated by , (comma).
Example:
[
{"name" : "Sudheer","blog1" : "techno-helper","blog2" : "booksnme"},
{"day" : 9,"month" : 11,"year" : 2008},
{"programmer":"true"},
{"null",null}
]
1 comment:
Informative and Educating !Keep writing !!
Post a Comment