I have a structure like so:
{
"name": "user",
"values":[["0.00207760","18.48000000"],["0.00207740","40.00000000"],["0.00207710","2.26000000"]]
}
I'd like to deserialize into a class like so using the popular Jackson library:
public class Values {
public String name;
public Map<BigDecimal, BigDecimal> values = new HashMap<>();
}
Where each entry in the values property becomes a key/value entry in the class' map.
However, if I attempt a simple deserialization with Jackson I get this error:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.TreeMap<java.lang.Object,java.lang.Object>` out of START_ARRAY token
at [Source: (String)"{"name": "user","values":[["0.00207760","18.48000000"],["0.00207740","40.00000000"],["0.00207710","2.26000000"]]...
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1442)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1216)
...
How can this be accomplished using Jackson?
Thanks!
Eduardo