Kotlin JSON deserialization with nested class discriminator
I want to use a
class discriminator in Kotlin to get polymorphic deserialization of JSON messages. The problem is that the class discriminator in my messages is nested one level deep:
{
"header": {
"message_type": "FooBar"
}
"data": {...}
}
The contents of data depend on message_type. If message_type were one level higher, this would...