We break down why you need a custom serializer in
kotlinx.serialization: how to separate the internal representation (for example,
Money as
Long cents) from the external JSON contract (the string
"12.34"), how to plug in a serializer via
@Serializable(
with = ...), what
KSerializer<T> consists of (
descriptor,
serialize,
deserialize ), why it is better not to parse money via
Double, and how to write fail-fast parsing with
SerializationException.