Hi All,
I am trying to seralise a complex object to Redis as hash using HMSET
I have one property that is a map<ENUM, UUID>
when I serialise the object to JsonObject I have the map serailsed to string and not to Json (String)
so I get this error when I try to desiralise the HASH from redis
java.lang.IllegalArgumentException: Cannot construct instance of `java.util.LinkedHashMap` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('{current=12d13a9f-c5f3-4d5f-8052-8191a222d5cd}')
at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: net.infraview.dcb.vendors.autointern.model.domain.MotorTurnDataImpl["terminals"])
at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:3738)
at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:3656)
at io.vertx.core.json.JsonObject.mapTo(JsonObject.java:99)
because the value of the map as string is not a json!
Ho do I serialise a POJO to JoonObject were any nested map is also serialised to a json string?
I can do the long way. Serialise to String and then back to JsonObject...
String json = Json.encode(mtd);
JsonObject obj = JsonObject.mapFrom(mtd);
but is there a shorter way, from POJO to JsonObject ?
thanks.
public class MotorTurnDataImpl {
private double duration;
private Map<TerminalType, UUID> terminals;
}