Matthew Cachia
03/04/2021, 7:46 AM@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,
@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.Dominaezzz
03/04/2021, 9:15 AMDominaezzz
03/04/2021, 9:16 AMDominaezzz
03/04/2021, 9:16 AM