-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone
Description
My application makes heavy use of the @JsonAnySetter/Getter annotations which is currently throwing an exception when deserializing an JSON array of strings as a property value:
Can not deserialize instance of java.lang.Object out of END_ARRAY token at [Source: org.apache.cxf.transport.http.AbstractHTTPDestination$1@7a5d231e; line: 22, column: 5] (through reference chain: com.mycorp.core.web.rest.dto.ItemDTO["ZoomLinks"])
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:164)
at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:575)
at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:569)
at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.deserialize(UntypedObjectDeserializer.java:90)
at com.fasterxml.jackson.databind.deser.SettableAnyProperty.deserialize(SettableAnyProperty.java:98)
at com.fasterxml.jackson.databind.deser.SettableAnyProperty.deserializeAndSet(SettableAnyProperty.java:88)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeWithUnwrapped(BeanDeserializer.java:515)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:271)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:121)
at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1179)
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:635)
Here is the Java code:
public void addProperty(String key, Object value) {
if (props == null)
{ props = new HashMap<String, Object>(); }
props.put(key, value);
}
@JsonAnyGetter
public Map<String, Object> getProperties()
{ return props; }
and here is some sample JSON that will fail:
{ "_type" : "IST",
"_spacename" : "Foo Models",
"_name" : "BLAH-New",
"_description" : "namespace.name: X THIN FIR.DR-WD12-New",
"ZoomLinks": [ "foofoofoofoo", "barbarbarbar" ] }
Metadata
Metadata
Assignees
Labels
No labels