Hi, is there a way how to deserialize dynamic stru...
# serialization
t
Hi, is there a way how to deserialize dynamic structure from JSON? For example I have this class but I don't know the exact structure of
data
property.
Copy code
@Serializable
data class Sample(
    val name:String,
    val data: Any
)
j
I don't know if it's what you search, but you can try to use JsonElement :
Copy code
Json.parseToJsonElement(sample).jsonObject["data"]
https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/json.md#json-elements