Open samuelorji opened 1 month ago
Have you tried if @transient
from the com.github.polokhotnyuk.jsoniter_scala.macros
package (or from the scala
package with CodecMakerConfig.withScalaTransientSupport(true)
argument for the make
call) placed at the field definition works for your case?
Please check both approaches shown in these tests.
Hi,
Is there a way to completely skip the serialization of an optional class field with a default value ?
As an example,
say I have a class Foo:
and I have this JSON:
Is there a way I can make the JsonCodecMaker skip the serialization of the "name" field in the json and by default just use the default value supplied in the case class. I tried using this config, but it doesn't work as expected because according to the doc, it will skip serialization if the field is the same as the default value, whereas I'm looking for an option where it completely skips the serialization of the field irrespective of the json value