Closed alexkahn closed 1 year ago
Is it about the file ending with a new line or not or do you mean a special character to denote the file end?
I think since ndjson is usually used on top of other protocols, these underlying protocols determine the "end of file".
Since I've been using some utilities that emit JSON as newline separated objects (e.g. mongoexport
), I was wondering if it was within the scope of this protocol to designate an End of [X] character where X is something analogous to a file to designate to a parser (e.g. JSON.parse
) that the end has been reached and it should not attempt to parse any more (i.e. not throw errors expecting more JSON).
It seems the implementation of such a character would be non-trivial since one would not want to make it something that can be included in a JSON object.
I think the definition of an EO? character is in the scope of the underlying protocol as @finnp said. Do you see any use case where this is not sufficient?
I agree that the EO? character should be out of scope. Going one step farther, I would say that the following characteristics are desirable for the format:
Introducing an EO? character would break this. And additionally, this behaviour would require NDJSON files to terminate with a newline character.
I think I like this proposals.
Many smaller NDJSON files can be concatenated into one large valid NDJSON file.
How can this be done if the last line doesn't end with '\n'? For ease of inserting/deleting etc. EVERY line should end with '\n'
Closing this because it's been 8 years and everything is fine not having an end of stream character.
Just wanted to see if there is an agreed upon end of file character or if that isn't something the specification is interested in supporting.