Evening folks! I'm using the latest Kotlinx serial...
# serialization
r
Evening folks! I'm using the latest Kotlinx serialization release and was wondering if the only way to handle an incomplete json is to tediously maintain custom deserializers for all classes that would require it? e: For fields that are non-nullable, mind you. I'm aware of the
explicitNulls
configuration for nullable properties with no default value
a
What do you mean by ‘incomplete json’? Could you share an example? That would help understand what you mean.
r
Say I have a class defined as
Copy code
data class MyClass(name: String, age: Int)
And I decode this json string
Copy code
{
  "name": "Bob"
}
I want the result to be
MyClass(name="Bob", age=0)
a
Copy code
data class MyClass(name: String, age: Int = 0)
?
r
I have no idea why I didn't even think about that... Thanks!
a
haha, you’re welcome