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:
Can not deserialize instance of Inner out of 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 retain the class stucture.
I understand that the issue is that Jackson is unable to map the inner array to the 'Inner' class. Do I have to use the Tree Model in Jackson? Or is there someway I can still use the DataModel here ?