Is it possible to use Kotlin Serialization for a J...
# serialization
p
Is it possible to use Kotlin Serialization for a JSON use-case (encoding and decoding) with no class discriminator and multiple polymorphic properties in either an interface or a sealed class? Here is a code example:
Copy code
sealed class ResponseError {
    abstract val code: Number
    abstract val message: String
    abstract val data: ErrorData? // where ErrorData is polymorphic (sealed class)
}
Both `Number`and `ErrorData`are polymorphic. Using content-based polymorphic deserialization is relatively straight-forward for either property alone but it is not clear to me how to use this deserialization approach for both properties simultaneously. What KSX strategies make sense for this kind of use case?