Thursday 5 July 2012

Concept about JSON

JSON or Javascript Object Notation is a way to storing data or information in organized manner. These information can access easily. These stored information is human readable so we can access it logical manner.
Example of JSON:
var jsonobj = { "name":"John", "age":"25 years", "sex":"Male" };
Above jsonobj variable is used to access the values. Property and values are kept inside curly braces like "property name":"property value" pair. Multiple vales can be kept using comma separation. We can access values stored in jsonobj by refering the name ofproperty like:
document.write(jsonobj.name+' is '+jsonobj.age+' old.');
Above code will output: John is 25 years old.

No comments:

Post a Comment