is really dynamic and can change from request to request (i know what it be in each request, because it equals request param). What is the best way to deserialize structure like that?
a
Adam S
03/28/2023, 9:21 AM
what about
dynamicKey
is dynamic? The value? The name?
You can try using
JsonElement
Copy code
@Serializable
data class MyData(
val staticKey: String,
val dynamicKey: JsonElement,
)
And then you can use a
when () {}
statement to decode it
i
iamthevoid
03/28/2023, 9:23 AM
Name of field is dynamic. It is free api, so i can't influence on api (
a
Adam S
03/28/2023, 9:26 AM
the easiest way is to just decode the whole response to a