Is there a good way of fixing kotlinx.serializatio...
# announcements
Is there a good way of fixing kotlinx.serialization's handling of nullable values? This class...
Copy code
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
key. I really dont want to add a default value of
to every single optional field
👍 1
Thats a good suggestion, thank you. But honestly its not much better than a null default value.... I guess im looking for a way to set it up during the instantiation of KotlinxSerializer (JsonBuilder)
I feel like defining that the property is nullable should be sufficient for it to be considered optional
looks like you have to provide a default value if that's the behavior you want
looks like
myProp: String? = null
is the way to go, for better or worse
thats unfortunate but oh well... Thank you!