Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_may_ contain newlines? #17

Closed
dominictarr opened this issue Oct 19, 2014 · 3 comments
Closed

_may_ contain newlines? #17

dominictarr opened this issue Oct 19, 2014 · 3 comments

Comments

@dominictarr
Copy link

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.

@finnp
Copy link
Member

finnp commented Oct 19, 2014

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?

@dominictarr
Copy link
Author

Oh you are right. I was looking at draft 1 from before you merged 1.0.0

@finnp
Copy link
Member

finnp commented Oct 19, 2014

Ah, okay. Thanks for your input anyways!
There also was a discussion about pretty printed JSON over here #1 The option of using \n\n as a separator wasn't considered though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants