Given json as follows where the structure of the payload
object will vary:
{
"id": 1,
"displayName": "Success",
"payload": {
"someProperty": "example",
"someOtherProperty": {
"someNestedProperty": "example"
}
}
}
...using kotlinx.serialization
how can I deserialize this into the following data class, where the value of payload
should be the raw json string of the payload object.
@Serializable
data class Stub(
val id: Int,
val displayName: String,
val payload: String
)