I'm new to Kotlin and trying to parse list of lists in JSON:
data class Root (val lists: List<List<String>>)
val result = Klaxon().parse<Root>("""
{
"lists": [["red", "green", "blue"]]
}
""")
But I get this runtime exception:
Exception in thread "main" java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
It seems that Klaxon can't quite figure out List<List<String>>
.
I also need this to work in general for nested collections:
List<List<*>>
Map<String, List<*>>
List<Map<String, *>>
Map<String, Map<String, *>>
This is fixed in Klaxon 2.1.11.