What does it stand for?
JavaScript Object Notation.
And what does that mean?
JSON is a syntax for passing around objects that contain name/value pairs, arrays and other objects.
Here's a example of JSON:
and we will compare this by a XML so this will loo like this
and if you want to access these values as a object form
var result = (Country.State[0].name)
so by this we will get the result "U.P"
quiggles, Squares, Colons and Commas
1. Squiggly brackets act as 'containers'
2. Square brackets holds arrays
3. Names and values are separated by a colon.
4. Array elements are separated by commas
Comparison with an array object
Object literals are created with curly brackets:
var Beatles = {
"Country" : "England",
"YearFormed" : 1959,
"Style" : "Rock'n'Roll"
}
This is the equivalent of:
var Beatles = new Object();
Beatles.Country = "England";
Beatles.YearFormed = 1959;
Beatles.Style = "Rock'n'Roll";
No comments:
Post a Comment