JSON: JavaScript Object Notation
Lightweight text data exchange format.
Why JSON?
More concise;
No end tags;
Faster read/write ability than XML
Syntax
Data stores in Key/Value pair;
Data is splitted by comma;
Brace stores object;
Bracket stores array;
Values
Number:1
{ "age":30 }
String
Boolean:1
{ "flag":true }
Array:1
2
3
4
5
6
7{
"sites": [
{ "name":"菜鸟教程" , "url":"www.runoob.com" },
{ "name":"google" , "url":"www.google.com" },
{ "name":"微博" , "url":"www.weibo.com" }
]
}
Object:1
{ "name":"Tutorials" , "url":"www.google.com" }
null:
{ "runoob":null }