<Serialization omitting nulls> I have a class like...
# stackoverflow
u
Serialization omitting nulls I have a class like this: @Serializable data class MyClass( val prop1: Int, val prop2: Int? ) When prop2 is null, I want to serialize this class without including the prop2 property. I can do this like this: val json = Json { explicitNulls = false } json.encodeToString(MyClass(42, null)) // gives {"prop1": 42} Unfortunately, there are many places in a large project that serialize this class, and currently they just use Json.encodeToString which includes the nulls explicitly. How...