andylamax
07/03/2020, 11:11 AM@Serializable
sealed class Result<T> {
@Serializable
class Success<T>(val data: T) : Result<T>()
@Serializable
class Failure<T>(val msg: String) : Result<T>()
}
So that If I have a class
@Serializable
data class Person(val name:String)
I can call
Json.stringify(Result.Serializer(Person.serializer()),Result.Success(Person("Andy)))
I have little knowledge in Polymorphic SerializationKroppeb
07/03/2020, 11:55 AMandylamax
07/03/2020, 11:57 AMPerson is not registered for Polymorphic Serialization
Kroppeb
07/03/2020, 11:59 AMJavier
07/03/2020, 12:36 PMandylamax
07/03/2020, 12:49 PMJavier
07/03/2020, 1:18 PMandylamax
07/03/2020, 1:24 PMJavier
07/03/2020, 1:26 PM