```@Serializable data class Request( @Serializ...
# serialization
m
Copy code
@Serializable
data class Request(
    @Serializable(with = EitherSerializer::class)
    val personOrCar: Either<Person, Car>,
    @Serializable(with = EitherSerializer::class)
    val catOrDog: Either<Cat, Dog>
)
I can easily specify my custom serializer to this sealed, third-party
Either
class. However,
Copy code
@Serializable
data class Request(
    //@Serializable(???)
    val map: Map<String, Either<Cat, Dog>>
)
Besides some other ideas†, Is there a way I can specify a serializer for my entry value? --- † one idea is to use a custom type to replace
Map
and define its own custom serializer. But this is definitely not ideal.
d
Move the annotation into the generics argument.
Map<String, @Serializable ......
Too lazy to type on my phone.