3

How to avoid serializing None to null using Circe json serializer? I am not able to force this library to skip serializing fields which are None. Is it possible to achieve?

Travis Brown
  • 138,631
  • 12
  • 375
  • 680
PawelN
  • 848
  • 7
  • 17

1 Answers1

5

I found the solution. We can provide implicit variable of instance 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 is working like a charm.

PawelN
  • 848
  • 7
  • 17
  • `dropNullKeys` has now been changed to `dropNullValues` - see also here: [link](https://github.com/circe/circe/issues/585) – Stratos K Apr 08 '20 at 09:44