我可以在不以其他形式重新设计json的情况下为这个对象创建json模式吗?
{
"itemColors": {
"40": "#12ffd6",
"69": "#f90861",
"185": "#063ac3"
},
"itemVisible": {
"32": true,
"33": true,
"34": true,
"36": true,
"37": true,
"38": true,
"39": true,
"40": true,
"41": true,
"55": true,
"56": true,
"69": true,
"185": true,
"187": true,
"196": true,
"197": true,
"198": true
}
}对象可以具有不同数量的属性。
ItemColors的值:
对于itemVisible也是如此,但是值必须是布尔型的。
发布于 2017-04-12 11:17:28
可以使用"additionalProperties"指定未指定属性的架构:
{
"properties" : {
"itemColors" : {
"type" : "object",
"additionalProperties" : {
"type" : "string"
}
},
"itemsVisible" : {
"type" : "object",
"additionalProperties" : {
"type" : "boolean"
}
}
}
}在这里阅读更多信息:https://spacetelescope.github.io/understanding-json-schema/reference/object.html
https://stackoverflow.com/questions/43363427
复制相似问题