You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My client application makes HTTP calls to 2 different servers. One server returns ExampleExtended instances and thus adds the '@Class' property containing the type information. The second server returns Example instances and thus does not add the '@Class' property containing the type information. However I specified the attribute 'defaultImpl' that will use that Example class when the type information is not present as explained in the javadoc:
Optional property that can be used to specify default implementation class to use for deserialization if type identifier is either not present, or can not be mapped to a registered type (which can occur for ids,
but not when specifying explicit class to use).
But when receiving the Example object, a JsonDeserializationException is thrown with the following message:
Cannot find the property @Class containing the type information
I tested this also with 'JsonTypeInfo.Id.NAME' but this gives the same error:
Cannot find the property @type containing the type information
I'm using the following versions:
gwt-jackson: 0.15.4
jackson-annotations: 2.9.0
gwt: 2.8.2
The text was updated successfully, but these errors were encountered:
I have a class DataDto public class DataDto { List<A> data; // + getters and setters }
The class A (default class) public class A { String id; // + getters and setters }
The class B (extends A) @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "@class", defaultImpl = A.class) public class B extends A { String name; // + getters and setters }
From 1 server, I get an A json. It's deserialized as A { data: [ { id = 5 }, {id = 6} ] }
From another server, I get an B json. It's deserialized as A but should be as B. { data: [ { @class: "B", id = 5, name = "test1" }, { @class: "B", id = 6, name = "test2"} ] }
Any clues?
I tried to add all possible combinations in whitelist without luck. Example whitelist("x.x.x.B");
Hi,
I'm having issues using the 'defaultImpl' attribute of JsonTypeInfo annotation. This is the situation:
`
public class Example {
}
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "@Class", defaultImpl = Example.class)
public class ExampleExtended extends Example {
}
public class JsonConfig extends AbstractConfiguration {
}
`
My client application makes HTTP calls to 2 different servers. One server returns ExampleExtended instances and thus adds the '@Class' property containing the type information. The second server returns Example instances and thus does not add the '@Class' property containing the type information. However I specified the attribute 'defaultImpl' that will use that Example class when the type information is not present as explained in the javadoc:
But when receiving the Example object, a JsonDeserializationException is thrown with the following message:
I tested this also with 'JsonTypeInfo.Id.NAME' but this gives the same error:
I'm using the following versions:
The text was updated successfully, but these errors were encountered: