A sample JSON:-
{"continents": {
"asia":[{"country": "india",
"code": "101"
},
{"country": "japan",
"code": "102"
}],
"europe":[{"country": "france",
"code": "401"
}]
}
}
The most notable features of JSON are:-
1. It is basically a collection of name-value pairs ("key": "value") separated by a colon.
2. It is not only easy to read for humans but also easy to parse by the machines.
3. Values can be a string, an integer, an object or an array.
Standard literals like True, False, null are also acceptable.
4. Each object is placed between {...}.
5. Arrays are place between [...] and are comma separated.
6. It can be passed using httpWebRequest.
7. Reserved keywords from JavaScript are not allowed in JSON.
8. JSON can be parsed using the eval() method in JavaScript.
9. It uses Unicode.
Common errors like the "missing } after property list" can be corrected
using a JSON validator like www.jsonlint.com
No comments:
Post a Comment