【发布时间】:2016-08-24 13:34:06
【问题描述】:
我需要将java.util.Map 实例映射到org.jsonschema2pojo maven 插件用来创建POJO 的JSON 模式。
我没有找到一个好的简单的解决方案。
有人可以帮帮我吗?
这是我实际的 json-schema 文件
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Response",
"description": "A Response object",
"type": "object",
"properties": {
"result": {
"type": "string",
"description": "describes response status"
},
"msg": {
"type": "string",
"description": "user msgs"
}
},
"required": ["result"],
"additionalProperties": false
}
我需要添加一个字段"errors",该字段在Java中转换为java.util.Map<String, String>。
【问题讨论】:
-
您能否详细说明您的问题?据我了解,您有一个描述的 JSON 模式,并且您的地图可能看起来像:“errors”:{“type”:“string”},然后您想将地图添加到您的 JSON 模式文件中并使用它在 jsonschema2pojo 中,对吗?如果我有任何误解,请举个例子,谢谢!
标签: java json maven jsonschema jsonschema2pojo