Introduction to json

JSON, or JavaScript Object Notation, is a text-based open standard designed for human-readable data interchange. Derived from the JavaScript scripting language, JSON is a language for representing simple data structures and associative arrays, called objects. Despite its relationship to JavaScript, JSON is language-independent, with parsers available for many languages.
In short JSON is syntax for storing and exchanging text information. Much like XML. JSON is smaller than XML, and faster and easier to parse.

Syntax for JSON

	"person": [
	              { "Name":"Robert" , "Sex":"Male" },
	              { "Name":"Cin" , "Sex":"Female" },
	              { "Name":"Shawn" , "Sex":"Male" }

Here every row is divided in key/value pairs, and we retrieve values as :

function func() 
var person = [ 
		"Name" 	: "Robert",
		"Sex" 	: "Male"
	}, {
		"Name" 	: "Cin",
		"Sex" 	: "Female"
	}, {
		"Name" 	: "Shawn",
		"Sex" 	: "Male"
	// writing first element to p tag
	document.getElementById("id1").innerHTML = person[1].Name;
	// person[1].Name represents 2nd element of variable person
<body onLoad="func()">
	<p id="id1">