spand
01/16/2023, 12:08 PMJsonTransformingSerializer<String>(String.serializer())
How can I add this to a json format, serializer module or whatever so it applies to all String
in the serialized type ? ie. I want to transform all stringsephemient
01/16/2023, 12:11 PM@Contextual
or polymorphic, in which case it retrieves the serializer from the serializersModule)@Serializable(with = ...) String
at all the use sitesspand
01/16/2023, 12:14 PMephemient
01/16/2023, 12:15 PMdecodeString
could, but that would break things like polymorphic type discriminatorsspand
01/16/2023, 12:16 PMephemient
01/16/2023, 12:17 PMspand
01/16/2023, 12:18 PMephemient
01/16/2023, 12:21 PMspand
01/16/2023, 12:24 PMAdam S
01/16/2023, 1:24 PM@JvmInline
@Serializable(with = MultibyteStringSerializer::class)
value class MultibyteString(val value: String): CharSequence by value
object MultibyteStringSerializer : KSerializer<MultibyteString> {
// encode/decode...
}
then you can use MultibyteString instead of String in your DTOsephemient
01/16/2023, 2:39 PM\\
in the outputAdam S
01/16/2023, 2:42 PMephemient
01/16/2023, 2:51 PM