Hi. Could you please advice how to fix `[Exception...
# serialization
m
Hi. Could you please advice how to fix
[Exception] class kotlin.String is not registered for polymorphic serialization in the scope of class kotlin.CharSequence class kotlinx.serialization.SerializationException
error?
s
Hm, it seems that you have to register it manually... Unfortunately, all standard standard types present in polymorphic serialization only in scope of
Any
m
code to reproduce:
Copy code
@Serializable
    data class SStrings(
            val strings: Map<String, CharSequence>
    )

    val sStrings = SStrings( mapOf("a" to "b"))

    val t = Json.stringify(SStrings.serializer(), sStrings)

    println(t)
Ok. Thanks