I have got a question on Kotlin serialization.
I want to use sealed classes to deserialize. Is there a way to change the type key from "type" to something else on the sealed class.
p
Paul Griffith
03/09/2021, 5:15 PM
#C7A1U5PTM
But yes, you can change the type discriminator - but only at the "global" level for an entire serializer instance, e.g:
Copy code
Json {
classDiscriminator = "\$type"
}
j
Jack Darlington
03/09/2021, 7:58 PM
I figured it out, had to use JsonTransformingSerializer to manually tweak the json