Question

With lift-json backed json4s, if I do the following:

val foobar = ("foo" -> JNothing) ~ ("bar" -> 42) 
println(write(foobar))

The output is:

{, "bar":42}

which is not valid JSON. I would like to obtain:

{"foo":null, "bar":42}

Is there any way to serialize JNothing into null?

Était-ce utile?

La solution

I have found that, if I replace JNothing for JNull, I get the results that I expect.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top