MSON描述蓝图中的对象属性 [英] MSON to describe object attributes in blueprint
问题描述
我遇到的问题类似于我有一个看起来像这样的JSON:
I have a JSON that looks like this:
{
"photos": [
{
"key": "y37dmj10jkwof/moOIUB8912JKVgh",
"caption": "A world of gamers.",
"tags": [
"game",
"japan"
],
"attributes": {
"copyright": true,
"use": [
"public",
"private"
]
}
}
]
}
并且我正在尝试使用MSON描述属性以呈现蓝图.但是,我没有成功.这是我的尝试:
and I am trying to describe the attributes using MSON, to render the blueprint. However, I am not successful at it. Here is my attempt:
+ 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)
想法有人吗? 任何输入将不胜感激.
Ideas anyone? Any input would be highly appreciated.
推荐答案
以下是我认为可以满足您需求的示例:
Here's an example that I think does what you want:
+ 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)
Note that you can put the sample values for the arrays as a comma separated list, and there's usually no need to explicitly state when the type is a string
or object
(unless it has no name). As for the attributes
object, you can put the keys on it directly, no need to make another level with + (object)
希望这会有所帮助!
这篇关于MSON描述蓝图中的对象属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!