New submission from Vito De Tullio <vito.detul...@gmail.com>:
It would be useful to let json.tool support empty rows during handling of json lines generally speaking, this tolerance is already present in parsers like srsly and jsonlines actual behavior: # happy scenario $ echo -e '{"foo":1}\n{"bar":2}' | python3.10 -mjson.tool --json-lines { "foo": 1 } { "bar": 2 } $ # spurious EOL at EOF $ echo -e '{"foo":1}\n{"bar":2}\n' | python3.10 -mjson.tool --json-lines { "foo": 1 } { "bar": 2 } Expecting value: line 2 column 1 (char 1) $ # two groups of "rows" in jsonl <- my current usecase $ echo -e '{"foo":1}\n\n{"bar":2}' | python3.10 -mjson.tool --json-lines { "foo": 1 } Expecting value: line 2 column 1 (char 1) $ my desired outcome is to preserve the EOLs, so to have something like: # happy scenario $ echo -e '{"foo":1}\n{"bar":2}' | python3.10 -mjson.tool --json-lines { "foo": 1 } { "bar": 2 } $ # spurious EOL at EOF $ echo -e '{"foo":1}\n{"bar":2}\n' | python3.10 -mjson.tool --json-lines { "foo": 1 } { "bar": 2 } $ # two groups of "rows" in jsonl $ echo -e '{"foo":1}\n\n{"bar":2}' | python3.10 -mjson.tool --json-lines { "foo": 1 } { "bar": 2 } $ ---------- components: Library (Lib) messages: 407289 nosy: ZeD priority: normal severity: normal status: open title: extend json.tool --json-lines to ignore empty rows type: enhancement versions: Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45929> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com