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

2021-12-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The current implementation allows for the final character of the input to be a newline. It does not allow double newlines. In the original example echo -e '{"foo":1}\n{"bar":2}\n' the echo command adds a newline to the output (which already contains

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

2021-12-10 Thread Łukasz Langa
Łukasz Langa added the comment: I agree with Serhiy that in general the fact that json.tool crashes here is useful: similarly to an exception in Python code, it can inform the user that some data they feed to json.tool is invalid. At the same time, I find it a bit obnoxious that the current

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

2021-12-08 Thread Alex Waygood
Change by Alex Waygood : -- nosy: -AlexWaygood ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2021-12-08 Thread Vito De Tullio
Vito De Tullio 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

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

2021-12-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Both JSON Lines (https://jsonlines.org/) and Newline Delimited JSON (http://ndjson.org/) formats require that Each Line is a Valid JSON Value. If you want to ignore empty lines you can filter them out with `sed /^$/d`. -- nosy: +serhiy.storchaka

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

2021-12-07 Thread Alex Waygood
Alex Waygood added the comment: I am changing the "version" field to 3.11, as enhancement proposals are generally only considered for unreleased versions of Python. -- nosy: +AlexWaygood, bob.ippolito, ezio.melotti, rhettinger versions: +Python 3.11 -Python 3.10

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

2021-11-29 Thread Vito De Tullio
Change by Vito De Tullio : -- keywords: +patch pull_requests: +28086 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29858 ___ Python tracker ___

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

2021-11-29 Thread Vito De Tullio
New submission from Vito De Tullio : 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