Shivam Verma
11/12/2022, 7:32 PMnull
if the deserialization fails (because the structure of the object changed). The closest approach I could find is this. However, this approach fails if the property changes to/from a primitive type.Dominaezzz
11/13/2022, 2:41 PMShivam Verma
11/13/2022, 3:10 PMShivam Verma
11/13/2022, 5:25 PMoverride fun deserialize(decoder: Decoder): AlphaProperty<T> {
decoder as JsonDecoder
val jsonElement: JsonElement = decoder.decodeJsonElement()
return try {
AlphaProperty.Known(Json.decodeFromJsonElement(valueSerializer, jsonElement))
} catch (e: Exception) {
AlphaProperty.Unknown
}
}
Dominaezzz
11/13/2022, 5:31 PMdecoder.json.decodeFromJsonElement
Dominaezzz
11/13/2022, 5:32 PMShivam Verma
11/13/2022, 5:57 PM