json就是散列字面量,不过有更加严格的限制
1、冒号左边必须带引号
如:"wishListItem":{
"wishID":4655
}
2、可以出现在右侧的值只有 单引号和双引号括住的字符串、true\false、数值、null, 表达式和变量名不允许出现
示例
[
{
"term":"BACKCHUS",
"part":"n.",
"definition":"A convinient deity invented by the ancients as an excuse for getting drunk.",
"quote":[
"Is public worship,then,a sin",
"that for devotions paid to Bacchus"
],
"author":"Jorace"
},
{
"term":"BACKBITE",
"part":"v.t.",
"definition":"To speak of a man as you find him when he can't find you .",
"author":"sss"
},
{
"term":"BEARD",
"part":"n.",
"definition":"the hair"
}
]
dojo中用json示例

接下来我们将这个数组传入 dojo.data.ItemFileReadStore,该驱动有如下限制
identifier(ID)
items(数据本身)
本文介绍了JSON数据格式的基本概念和使用规范,包括其作为散列字面量的特点及限制条件,并提供了一个具体的示例来说明如何定义JSON数据结构。
71

被折叠的 条评论
为什么被折叠?



