For polymorphic objects, Is there any way of suppressing the type field output into json by
kotlinx.serialization
when all you're doing is serializing with no care for deserialization later, or allow specification of another field instead of type as the discriminator
e
Emil Kantis
07/08/2021, 2:56 PM
You can change the name of the property using
classDiscriminator = "otherProperty"
. As far as I know you can't omit it completely. It's something I would like as well..
m
Mark Allanson
07/08/2021, 2:57 PM
yeah we can get away with that until we have more than one polymorphic scenario in the model 😄
e
ephemient
07/08/2021, 6:30 PM
bit of a hack but this would work (for json only):