I cannot convert JSON to Kotlin data class using Gson due to the MutableMap object. The data class
data class MyAction(
@Key("action") var action: String = "default",
@Key("data") var data: MutableMap<String, Any> = mutableMapOf()
)
values in the data
map are of several types.I tried with TypeToken and Generics, as in here but didn't work. Examples of received json:
{"action":"playVideo","data":{"media":{"id":15060328,"url":"http://url_to_get_item","name":"item name","shortDescription":"short desc"}
{"action":"setSpeed","data":{"value":1}}
{"action":"getProperty","data":{"value":"position"}}