skoude
10/12/2016, 11:50 AMfun <T> fromJson2(jsonString: String ) : List<T> {
val JSON = ObjectMapper().registerModule(KotlinModule())
val myList = JSON.readValue<List<T>>(jsonString)
return myList
}
returns java.util.LinkedHashMap
instead of Employee
, when called like
val employee2 : List<Employee> = fromJson2<Employee>(jsonString = jsonString)
I just don't get it... If I change <List<T>>
to <List<Employee>>
it works, but then it's not general code that I can use to serialize json to object..