When using polymorphic serialization is there any way to
1. have the class discriminator available as a property on the base class
2. default to a particular subclass?
My usecase has the
type
property on the json object somewhat overloaded where for one value i want to deserialize it into class A, but any other value is of type B and I need access to the
type
value. Adding
type
as a property gives an error
Copy code
because it has property name that conflicts with JSON class discriminator 'type'. You can either change class discriminator in JsonConfiguration, rename property with @SerialName annotation or fall back to array polymorphism
I couldnt find any reference too array polymorphism anywhere
d
Dominaezzz
05/12/2021, 11:22 PM
There's an issue open for the first one.
🙏 1
Dominaezzz
05/12/2021, 11:22 PM
The second one is possible using the serialise module.