9-17易科 日志
json语法规则
json对象
对象可以包含多个名称/值对:
{ "firstName":"John" , "lastName":"Doe" }
这条 JavaScript 语句等价:
firstName = "John"
lastName = "Doe"
json数组
JSON 数组在方括号中书写:
数组可包含多个对象:
{
"employees": [
{ "firstName":"John" , "lastName":"Doe" },
{ "firstName":"Anna" , "lastName":"Smith" },
{ "firstName":"Peter" , "lastName":"Jones" }
]
}
例子
var employees = [
{ "firstName":"Bill" , "lastName":"Gates" },
{ "firstName":"George" , "lastName":"Bush" },
{ "firstName":"Thomas" , "lastName": "Carter" }
];
点赞
评论