[issue31553] Extend json.tool to handle jsonlines (with a flag)

Serhiy Storchaka report at bugs.python.org
Sat Sep 23 00:58:48 EDT 2017


Serhiy Storchaka added the comment:

Jsonlines is an external to JSON format. You should split the data on lines and pass every line to the JSON parser separately. The same you should do with json.tool.

$ echo -e '{"ingredients":["frog", "water", "chocolate", "glucose"]}\n{"ingredients":["chocolate","steel bolts"]}' | while read -r line; do echo -n "$line" | python -m json.tool; done
{
    "ingredients": [
        "frog",
        "water",
        "chocolate",
        "glucose"
    ]
}
{
    "ingredients": [
        "chocolate",
        "steel bolts"
    ]
}

----------
nosy: +serhiy.storchaka

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


More information about the Python-bugs-list mailing list