l
Untitled
s
You can use an
inline
function with
reified
generics
Copy code
inline fun <reified T> parseJson(json: String?): T {
    return objectMapper.readValue(json, T::class.java)
}
1
And if the kotlin compiler has enough information to infer the type parameter you won't have to pass it explicitly