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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.