yeah, that happens because `Type` has no generic p...
# getting-started
k
yeah, that happens because
Type
has no generic param so there's no way for that method to include any sort of generic type info. You could define your own extension method on
Gson
that takes in a
TypeToken
like:
Copy code
fun <T> Gson.from(json: String, typeToken: TypeToken<T>): T = fromJson(response.jsonString, typeToken.type)
and invoke it as
val foo = Gson().from(response.jsonString, typeToken)