Mgj
09/17/2020, 3:09 PM@Serializable
data class MyDataClass(
val myProp: String?
)
... will throw kotlinx.serialization.MissingFieldException: Field 'myProp' is required, but it was missing
if the json does not contain the myProp
key. I really dont want to add a default value of null
to every single optional fieldnanodeath
09/17/2020, 3:12 PM@Optional
?Mgj
09/17/2020, 3:14 PMMgj
09/17/2020, 3:16 PMnanodeath
09/17/2020, 3:16 PMnanodeath
09/17/2020, 3:17 PMnanodeath
09/17/2020, 3:18 PMmyProp: String? = null
is the way to go, for better or worseMgj
09/17/2020, 3:20 PMMgj
09/17/2020, 3:20 PM