Custom Serializers
Handle special types.
Why Custom Serializers?
Some types have no built-in serializer: java.util.Date, LocalDate, UUID, or types from third-party libraries.
A custom serializer defines how such a type maps to and from a serial form.
The KSerializer Interface
A custom serializer implements KSerializer<T> with three members: descriptor, serialize, and deserialize.
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder