https://kotlinlang.org logo
#serialization
Title
# serialization
c

Christian Lutnik

08/23/2022, 6:27 AM
Hello! Is there a way to serialize properties of a (sealed) superclass without using surrogates?
x

xxfast

08/24/2022, 2:35 AM
last time i checked it was serialising sealed properties correctly, as long as your sealed hierarchy looks like
Copy code
sealed class Parent {
  abstract val parentProperty: String
  data class Child(override val parentProperty: String, val childProperty: String): Parent()
}
c

Christian Lutnik

08/24/2022, 6:08 AM
Yes, but is there a way to serialize non abstract properties of the superclass?
3 Views