문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top