defaultDeserializer
Adds a default serializers provider associated with the given baseClass to the resulting module. defaultDeserializerProvider is invoked when no polymorphic serializers associated with the className
were found. className
could be null
for formats that support nullable class discriminators (currently only Json
with JsonBuilder.useArrayPolymorphism
set to false
)
Default deserializers provider affects only deserialization process. To affect serialization process, use SerializersModuleBuilder.polymorphicDefaultSerializer.
defaultDeserializerProvider can be stateful and lookup a serializer for the missing type dynamically.
Typically, if the class is not registered in advance, it is not possible to know the structure of the unknown type and have a precise serializer, so the default serializer has limited capabilities. If you're using Json
format, you can get a structural access to the unknown data using JsonContentPolymorphicSerializer
.