I am using Scalatra, which in turn uses Json4S to generate Json string. I receive
["A","B"]
for
List(Some("A"),None,Some("B"))
I would like to receive
["A",undefined,"B"]
How can this be fixed ?
I am using Scalatra, which in turn uses Json4S to generate Json string. I receive
["A","B"]
for
List(Some("A"),None,Some("B"))
I would like to receive
["A",undefined,"B"]
How can this be fixed ?
undefined
is not a valid json value, even though it is valid in javascript. From rfc4627 (application/json):(no mention of undefined)
However this is fairly straight-forward to do with
null
instead ofundefined
. In the scala console, first a couple imports:A customer serializer:
And voila: