I have the following JSON:
{ fields : { "foo" : "foovalue", "bar" : "barvalue" } }
I wrote pojo as follows:
public class MyPojo { @JsonProperty("fields") private List<Field> fields; static class Field { @JsonProperty("foo") private String foo; @JsonProperty("bar") private String bar;
This fails because my json field fields is a hashmap, not a list.
My question is: is there any βmagicβ annotation that can cause Jackson to recognize map keys as pojo property names and assign map values ββto pojo property values?
PS: I really don't want my field objects to be ...
private Map<String, String> fields;
... because in my real json I have complex objects in map values, not just strings ...
Thanks; -)
Philip
java json jackson serialization
Philippe
source share