Adsense
Popular Posts
- MySQL workbench -"Could not decrypt password cache"
- peer review (3)
- PHP, dump varailbes in a format way
- "Unusual traffic from your computer network" from blogger
- Install APXS in Redhat Linux
- JavaScript, remove trailing insignificant zeros after toFixed function
- Update member directory
- Set Windows path command line
- JavaScript: add days to current date
- DataTable table order by numeric, not by text
Saturday, March 1, 2014
JSON: JavaScript Object Notation.
Similar to XML, JSON is used to store message in JavaScript. But JSON is smaller than XML and easy to parse.
JSON format:
a name followed by colon, followed by a value, such as
"fruit":"apple"
i.e fruit = "apple"
JSON object using curly bracket
var temp={"fruit":"apple", "juice":"orange"}
To access JSON object value:
temp.fruit, temp,juice
JSON array using square bracket:
var JSONarray= {
"food":[
{"fruit":"apple", "juice":"orange"},
{"fruit":"banana", "juice":"watermelon"}
]
}
To access the value fruit in array
JSONarray.food[0].fruit
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment