Given the following data
{ "version" : 1, "data" : [ [1,2,3], [4.5,6]] }
I tried the following definitions and used ObjectMapper.readValue(jsonstring, Outer.class)
class Outer { public int version; public List<Inner> data } class Inner { public List<Integer> intlist; }
I got:
Unable to deserialize Inner instance from START_ARRAY token
In the Outer class, if I say
List<List<Integer> data;
then deserialization works.
But in my code, the Outer and Inner classes have some business logic related methods, and I want to save the class.
I understand that the problem is that Jackson cannot map the internal array to the Internal class. Should I use a tree model in Jackson? Or can I still use the DataModel here?
source share