You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to serialize and deserialize multiple instances of a common interface. To do this, the README says I should use JsonDiscriminatorProperty and JsonDiscriminatorValue. However, it doesn't say what these actually do, or what the requirements are for using these decorators, so I will ask here:
Is it required that my superclass/interface has a property that describes the subclass type? For example, the Animal type in the example has a type:AnimalType field (pointed to by the JsonDiscriminatorProperty decorator). Is this required for (de)serialization to work?
In other words:
Do I have to create a distinct value (e.g. via an enum) for all the subtypes of the interface/superclass I want to serialize?
Do all instances need a property that is set to this value?
The text was updated successfully, but these errors were encountered:
I would like to serialize and deserialize multiple instances of a common interface. To do this, the README says I should use
JsonDiscriminatorProperty
andJsonDiscriminatorValue
. However, it doesn't say what these actually do, or what the requirements are for using these decorators, so I will ask here:Is it required that my superclass/interface has a property that describes the subclass type? For example, the
Animal
type in the example has atype:AnimalType
field (pointed to by theJsonDiscriminatorProperty
decorator). Is this required for (de)serialization to work?In other words:
The text was updated successfully, but these errors were encountered: