Hi guys! I’m trying to do polymorphic deserializat...
# serialization
m
Hi guys! I’m trying to do polymorphic deserialization of a JSON object. Is this possible without classDiscriminator? The JSON object is generated by some PHP server, and so it doesn’t have the “type” field. How do I deserialize this polymorphically in Kotlin?
c
you can either use an explicit type discriminator (where that exists) or infer the type from the data (if possible to do so accurately), for example “when field x exists it is TypeY”.
👍 1