I have a type like this one below, and I want to write
CustomMapSerializer so that it deals with the
fields property by handing the map values to different Serializers, depending on the key.
@Serializable data class Foo(@Serializable(with=UUIDSerializer::class) val fooID: UUID, @Serializable(with=CustomMapSerializer::class) val fields: Map<String, Any?>)
The docs for
kotlinx.serialization explain a little about a custom serializer for a compound type like a data class, but I don’t see anything on how to handle a variable sized collection like this.
Is there documentation or example code on this anywhere?