ndjson / ndjson-spec

Specification
680 stars 29 forks source link

Specify End of File #24

Closed alexkahn closed 1 year ago

alexkahn commented 9 years ago

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.

hoegertn commented 9 years 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?

finnp commented 9 years ago

I think since ndjson is usually used on top of other protocols, these underlying protocols determine the "end of file".

alexkahn commented 9 years ago

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.

hoegertn commented 9 years ago

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?

nicwaller commented 7 years ago

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.

hoegertn commented 7 years ago

I think I like this proposals.

burn2l commented 1 year ago

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'

alexkahn commented 1 year ago

Closing this because it's been 8 years and everything is fine not having an end of stream character.