我有一个类似于here描述的问题。
我有一个JSON,看起来像这样:
{
"photos": [
{
"key": "y37dmj10jkwof/moOIUB8912JKVgh",
"caption": "A world of gamers.",
"tags": [
"game",
"japan"
],
"attributes": {
"copyright": true,
"use": [
"public",
"private"
]
}
}
]
}我正在尝试使用MSON来描述属性,以呈现蓝图。然而,我在这方面做得并不成功。这是我的尝试:
+ Attributes (required, object)
+ photos (required, array)
+ (object)
+ key (required, string) - Photo key
+ caption (required, string) - Photo caption
+ tags (required, array)
+ game (string)
+ japan (string)
+ attributes (required, object)
+ (object)
+ copyright: true (required, boolean)
+ uses (required, array)
+ public (string)
+ private (string)有谁有想法吗?任何意见都将受到高度赞赏。
发布于 2015-08-03 16:03:38
下面是一个示例,我认为它可以满足您的需求:
+ Attributes
+ photos (required, array)
+ (object)
+ key: y37dmj10jkwof/moOIUB8912JKVgh (required) - Photo key
+ caption: A world of gamers (required) - Photo caption
+ tags: game, japan (required, array)
+ attributes (required)
+ copyright: true (required, boolean)
+ use: public, private (required, array)请注意,您可以将数组的示例值作为逗号分隔的列表,并且通常不需要显式声明类型是string还是object (除非它没有名称)。至于attributes对象,您可以直接将键放在它上面,而不需要使用+ (object)创建另一个级别
希望这能有所帮助!
https://stackoverflow.com/questions/31752483
复制相似问题