Is it possible to deserialize a sealed class by va...
# serialization
i
Is it possible to deserialize a sealed class by value of some field, and by using the parent (sealed class)
serializer
, not the implementing class'
serializer
? For example:
Copy code
{
   "key": "obj1"

    // or 
  
   "key": "obj2"
}
Copy code
@SerialName("key")
sealed class Sealed {
   @SerialName("obj1")
   object Obj1

   @SerialName("obj2")
   object Obj2
}

...

val obj = json.decodeFromString(Sealed.serializer(), jsonInput)