[issue45929] extend json.tool --json-lines to ignore empty rows

Vito De Tullio report at bugs.python.org
Wed Dec 8 04:44:53 EST 2021


Vito De Tullio <vito.detullio at gmail.com> added the comment:

My final goal is to preserve the empty lines - I think I can do some bash magic, but maybe something more complex that a simple sed call.

FWIW on https://jsonlines.org/#line-separator-is-n I see "The last character in the file may be a line separator, and it will be treated the same as if there was no line separator present.".
And on https://github.com/ndjson/ndjson-spec#32-parsing I see "The parser MAY silently ignore empty lines, e.g. \n\n. This behavior MUST be documented and SHOULD be configurable by the user of the parser.".

While I get this choice can be "on a grey area", I think this is a known "dialect" of the jsonl specs.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45929>
_______________________________________


More information about the Python-bugs-list mailing list