I'm using DD4T Java release v2.0.4. FasterXML Jackson package v2.6.4.
When deserializing a Page JSON I'm getting the following error:
com.fasterxml.jackson.databind.JsonMappingException:
Can not construct instance of org.dd4t.contentmodel.impl.BaseField,
problem: abstract types either need to be mapped to concrete types,
have custom deserializer, or be instantiated with additional type
information at [Source: {"RevisionDate":"2016-05-06T14:15:45",
"Filename":"article","LastPublishedDate":"0001-01-01T00:00:00",
"PageTemplate":{"FileExtension":"html","RevisionDate":"2016-05-06T14:04:10.727",
"MetadataFields":{"view":{"Name":"view","Values":["Jump"],"NumericValues":
...................etc etc etc .......... at line: 1, column: 200]
(through reference chain: org.dd4t.contentmodel.impl.PageImpl["PageTemplate"]->
org.dd4t.contentmodel.impl.PageTemplateImpl["MetadataFields"]->
java.util.LinkedHashMap["view"])
The error makes sense, since the MetadataFields
declaration in BaseRepositoryLocalItem
looks like:
@JsonProperty ("MetadataFields")
@JsonDeserialize (contentAs = BaseField.class)
protected Map<String, Field> metadata;
How is this supposed to work? Should I create my own specific model object? Should I create a custom deserializer? Or is it actually a bug?
Thanks in advance!