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
I have a object that contains a minimal-json JsonObject as field and I try to serialise the object with jackson to JSON to store the object as String and deserialise it afterwards. The mechanism is explained here:
As soon as I try to deserialise the stored object I run into this error message:
com.fasterxml.jackson.databind.exc.InvalidDefinitionException:
Cannot construct instance of `com.restfb.json.JsonNumber`
(no Creators, like default construct, exist): cannot deserialize from Object value
(no delegate- or property-based Creator)
According to this message the default constructor is missing, but adding one seems not be a solution because JsonNumber, JsonString and JsonLiteral contain a inner private final field and it seems this disturbs the deserialisation process.
ATM the solution is to store the JSON as String and have a getter that parses the String with minimal-json on demand, but perhaps you are interested in solving this on your side ;)
The text was updated successfully, but these errors were encountered:
I have a object that contains a minimal-json JsonObject as field (...)
I understand the issue you are describing. However, I've never considered having a class with a JsonObject member. Does it make sense in your domain? Is it a payload-like field in a message-like object?
Does Jackson make this possible to fix in the calling code? Such as by registering an object capable of transforming JsonObject into something that Jackson can understand and vice-versa.
I have a object that contains a minimal-json JsonObject as field and I try to serialise the object with jackson to JSON to store the object as String and deserialise it afterwards. The mechanism is explained here:
http://www.baeldung.com/jackson-object-mapper-tutorial
As soon as I try to deserialise the stored object I run into this error message:
According to this message the default constructor is missing, but adding one seems not be a solution because
JsonNumber
,JsonString
andJsonLiteral
contain a inner private final field and it seems this disturbs the deserialisation process.ATM the solution is to store the JSON as String and have a getter that parses the String with minimal-json on demand, but perhaps you are interested in solving this on your side ;)
The text was updated successfully, but these errors were encountered: