1

In my application, I need to have some Options encode to null when empty and others excluded when empty. Based on the signature of Encoder this doesn't seem to be possible for a special type wrapping Option. Is there a good way to handle this?

Edit: In other answers (like Encoding Scala None to JSON value using circe) this question has been touched upon but with no suitable solution. In all of the answers supplied it is an explicit workaround that must be dealt with. I'm looking for a more general fix going forward. This is ultimately something that seems to be a missing feature in Circe, and (according to @travis-brown) will be addressed in the near future.

Community
  • 1
  • 1
darkfrog
  • 963
  • 6
  • 24
  • 2
    Possible duplicate of [Encoding Scala None to JSON value using circe](http://stackoverflow.com/questions/42358455/encoding-scala-none-to-json-value-using-circe) – OlivierBlanvillain May 17 '17 at 08:52

0 Answers0