Json4s ignoring None fields during seriallization (instead of using 'null')
问题 I am having a generic json serialization method that uses json4s . Unfortunately, it is ignoring fields if the value is None . My goal is to have None fields be represented with a null value. I tried by adding custom serializer for None, but still it is not working. object test extends App { class NoneSerializer extends CustomSerializer[Option[_]](format => ( { case JNull => None }, { case None => JNull })) implicit val f = DefaultFormats + new NoneSerializer case class JsonTest(x: String, y: