I have a .json file that contains string to double array value. Currently I can get a “Map<String, List<List>>” which works but, I would like to get a “Map<String, List>” back instead.
static String JSON = """
{
"data1": [ [ 1, 2, 3], [4, 5, 6] ],
"data2": [ [ 9, 8, 7], [6, 5, 4] ]
}
""";
public static void main(String[] args){
ObjectMapper mapper = new ObjectMapper();
Map<String, List<List<Double>>> values = mapper.readValue(JSON, Map.class);
}
How could I set this up so that instead of a List<Double>
I could have a List<MyPoint>
instead.
This is similar to How to use Jackson to deserialise an array of objects but I need to include a conversion.