kotlinx.serialization
kotlinx.serialization copied to clipboard
Option to omit null values in CBOR serialization
What is your use-case and why do you need this feature?
For JSON, there is an option to specify explicitNulls = false (docs) to omit properties with null values. It would be really helpful to have that option for CBOR as well. You can work around it by using encodeDefaults = false and use null as default value for the properties, but it's a bit cumbersome and doesn't work for all use cases.
Describe the solution you'd like
An option to set explicitNulls = false in CborBuilder (like for JSON).