kotlinx.serialization icon indicating copy to clipboard operation
kotlinx.serialization copied to clipboard

Option to omit null values in CBOR serialization

Open Shiph opened this issue 1 year ago • 0 comments

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).

Shiph avatar Dec 16 '24 09:12 Shiph