play-json-extensions
play-json-extensions copied to clipboard
Support for OptionHandlers
Is there any way to write None values as null?
With play.api.libs.json.Json, I could do this:
case class Reason(name: String, flag: Option[Boolean])
implicit val conf = JsonConfiguration(optionHandlers = OptionHandlers.WritesNull)
implicit val jsonFormat = Json.format[Reason]
This would emit null for "flag" if the value is None.
Is something similar available for use with Jsonx.formatCaseClass invocation?