I use Jackson 2.2.3 on my latest android Project. I have included the jars (core, databingin, annotation) as jars to my android libs folder.
But i get this error when reading / parsing json. Write json from an objects works.
I call this:
objectMapper.readValue(inputStream, SubscriptionWrapper.class);
com.fasterxml.jackson.databind.JsonMappingException: Conflicting setter definitions for property "wallpaper": android.content.Context#setWallpaper(1 params) vs android.content.Context#setWallpaper(1 params) at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:272) com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:272) com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:247) com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:146) at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:305) at com.fasterxml.jackson.databind.deser.std.StdDeserializer.findDeserializer(StdDeserializer.java:634) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:438) at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:298) ... at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2884) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2034)
My class looks like this
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(Include.NON_NULL)
public class SubscriptionWrapper {
@JsonProperty("device")
private Device device;
@JsonProperty("subscriptions")
private List<Subscription> subscriptions;
public SubscriptionWrapper() {
}
public SubscriptionWrapper(Device device, List<Subscription> subscriptions) {
this.device = device;
this.subscriptions = subscriptions;
}
public Device getDevice() {
return device;
}
public void setDevice(Device device) {
this.device = device;
}
public List<Subscription> getSubscriptions() {
return subscriptions;
}
public void setSubscriptions(List<Subscription> subscriptions) {
this.subscriptions = subscriptions;
}
}
Any idea what could be wrong? I have used jackson in other projects without any issues.