Enum Serializer
inline fun <T : Enum<T>> EnumSerializer(crossinline value: (T) -> Any, default: T? = null): KSerializer<T>
A kotlinx.serialization serializer that allow serialization to/from a specific value type while also allowing for an optional default value. The optional value only works for values of the same type. KotlinX Serialization throws an exception for anything of an unexpected type.
NOTE: @SerialName does not work with this serializer. Use your own custom value to change the serialized value.