Hello. The polymorphic serialization of a sealed c...
# serialization
m
Hello. The polymorphic serialization of a sealed class is generating this kind of json:
Copy code
["folder",{"clipFolderId":{"value":"ae5cab51-4336-494f-86c8-e233cebc5467"}}]
instead of something like:
Copy code
{type:"folder", "clipFolderId":{"value":"ae5cab51-4336-494f-86c8-e233cebc5467"}}
as is described in the documentation. I'm using
org.jetbrains.kotlin:kotlin-serialization:1.4.31
and
org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0
. What could be the cause?
d
Can you share the sealed class?
I'm more interested in the annotations, so you don't have to share the whole thing.
Also, the
Json
instance you pass to KTor, what are the params you pass to it?