I'm using GSON to parse JSON the following way:
var obj = Gson().fromJson( json, Array<MyDataModel>::class.java ).toList()
I would like to be able to pass the data type via method the following way:
fun convert( t : Any ) : Any
{
return Gson().fromJson( mockedResponse, t ).toList()
}
val model = convert( Array<MyDataModel>::class.java )
but I get:
None of the following functions can be called with the arguments supplied
I also tried Type as the argument data type, but the same error persists. How can I pass the DataType to my convert method? Thanks!
Aucun commentaire:
Enregistrer un commentaire