kevinmost
11/10/2016, 11:38 PMType
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:
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)