Lars Erik Rojeras
09/08/2020, 1:39 PM{
"history": {
"2020-08-01": 189812,
"2020-08-02": 185951,
"2020-08-03": 390080
}
}
And the relevant code:
@Serializable
data class HistoryInfo(
val history: Map<String, Int>
)
....
val json = Json(JsonConfiguration.Stable)
val history = json.parse(HistoryInfo.serializer(), response)
for ((key, value ) in history.history) {
println("$key : $value")
}
That is, history.history will be a Map<String, Int>.
In Kotlin 1.4 and serializationVersion=1.0.0-RC I try
val history = JSON.parse<HistoryInfo>(response)
but the history.history will not be a map. I cannot see how to access the data. How do I get my map back?