Closed dominictarr closed 10 years ago
Thanks, but it actually says right now The JSON texts MUST NOT contain newlines or carriage returns.
, not MAY
. Or did I get something wrong?
Oh you are right. I was looking at draft 1 from before you merged 1.0.0
Ah, okay. Thanks for your input anyways!
There also was a discussion about pretty printed JSON over here https://github.com/ndjson/ndjson-spec/issues/1 The option of using \n\n
as a separator wasn't considered though.
I suggest changing "may contain newlines" in https://github.com/ndjson/ndjson-spec#31-serialization to must not contain newlines. That makes it much simpler to implement the parser, split on newlines, and then parse with existing json library.
If the strings may contain newlines, you need a special parser that understands dnjson, because you need to match brackets and check whether you are inside a string, etc, to know whether a given newline delimits json objects, or is merely inside the json.
Alternatively, allow newlines but only non-consecutive newlines, and then make the delimiter two new lines.