joelittlejohn / jsonschema2pojo

Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc
http://www.jsonschema2pojo.org
Apache License 2.0
6.22k stars 1.66k forks source link

How to declare one field as Map? #1611

Closed zjffdu closed 4 months ago

zjffdu commented 4 months ago

I know in jsonschema2pojo additionalProperties is java Map, but how can I declare one specific field also as Map? e.g. I want the following field config to be a Map.

{
  "type":"object",
  "properties": {
    "config": {
        "type" : "string"
    }
  }
}
joelittlejohn commented 4 months ago

One option is to say: "existingJavaType": "java.util.Map<String,String>"

zjffdu commented 4 months ago

Thanks @joelittlejohn