default

fun default(defaultSerializerProvider: (className: String?) -> DeserializationStrategy<out Base>?)

Adds a default serializers provider associated with the given baseClass to the resulting module. defaultSerializerProvider 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)

defaultSerializerProvider 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. To have a structural access to the unknown data, it is recommended to use JsonTransformingSerializer or JsonContentPolymorphicSerializer classes.

Default serializers provider affects only deserialization process.