【发布时间】:2016-02-24 10:56:33
【问题描述】:
我有这样的 json 架构定义:
(更新:基本上是它的草稿03格式:http://json-schema.org/draft-03/schema#)
{
"$schema": "http://json-schema.org/draft-03/schema",
"product": {
"name": {
"required": true,
"type": "string"
},
"description": {
"required": true,
"type": "string"
}
},
"type": "object"
}
但我需要这种格式(标准 json 模式结构),即草稿 04 格式(http://json-schema.org/draft-04/schema#)
{
"type": "object",
"properties": {
"product": {
"type": "object",
"required": [
"name",
"description"
],
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
}
}
}
},
"required": [
"product"
]
}
是否有任何转换器可以将上述格式转换为这种格式?我只是不想手动操作,这可能容易出错。
【问题讨论】:
标签: javascript json jsonschema