Sunday, November 7, 2010

JSON-JavaScript Object Notation

JSON is a syntax for passing around objects that contain name/value pairs, arrays and other objects.
It is a lightweight text-based open standard designed for human-readable data interchange.
And it is language-independent, with parsers available for virtually every programming language.The JSON format is often used for transmitting structured data over a network connection.
JSON is primarily used to transmit data between a server and web application, serving as an alternative to XML.

JSON Format
  • An object is an unordered set of name/value pairs.
  • An object begins with { (left brace) and ends with } (right brace).
  • Each name is followed by : (colon).
  • The name/value pairs are separated by , (comma).
  • An array begins with [ (left bracket) and ends with ] (right bracket). Values are separated by , (comma).
The following example shows the JSON representation of an object that describes a employee.
The object has string fields for first name and last name, a number field for age, contains an object representing the person's address, and contains a list (an array) of phone number objects.
"firstName": "John",
"lastName": "Smith",
"age": 25,
"streetAddress": " Street",
"city": "New York",
"type": "home",
"number": "212 555-1234"
"type": "fax",
"number": "646 555-4567"


No comments:

Post a Comment