Generating Json string using Json4S from a list containing Some and None values
问题 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 ? 回答1: undefined is not a valid json value, even though it is valid in javascript. From rfc4627 (application/json): A JSON value MUST be an object, array, number, or string, or one of the following three literal names: false null true (no mention of undefined) However this is fairly straight-forward to