Avoid serializing to zero with Circe json serializer

How to avoid None to null serialization using Circe json serializer? I cannot get this library to skip serialization fields that are None. Is it possible to achieve?

+1
source share
1 answer

I have found a solution. We can provide an implicit instance variable for the Printer with our configuration. https://github.com/circe/circe/blob/master/modules/core/shared/src/main/scala/io/circe/Printer.scala We can set dropNullKeys to null and everything works like a charm.

+1
source

Source: https://habr.com/ru/post/1670361/


All Articles