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

Tech

09/23/2023, 12:15 PM
Hey I was wondering if it was possible to have polymorphic serializers' properties get passed down to their children?
Copy code
@Polymorphic
@Serializable
abstract class BaseData {
  @SerialName("some_random_type")
  val someRandomType: String
}

@Serializable
data class ImplementedData(
  override val someRandomType: String
) : BaseData()
I need the @SerialName property to be passed down to the child without me having to manually specify it again on
ImplementedData
, I looked at the docs and didn't really see any reference to what I'm trying to do. Thank you in advance!
2 Views