This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Eric Moyer
Recipients Eric Moyer
Date 2017-09-22.16:41:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1506098466.58.0.224432895447.issue31553@psf.upfronthosting.co.za>
In-reply-to
Content
json.tool should have the ability to format jsonlines data. It is a very commonly used format in many industries. Right now when given jsonlines (for example):

    echo -e '{"ingredients":["frog", "water", "chocolate", "glucose"]} | python -m json.tool

Works. But:

    echo -e '{"ingredients":["frog", "water", "chocolate", "glucose"]}\n{"ingredients":["chocolate","steel bolts"]}' | python -m json.tool

Reports an error: "Extra data: line 2 column 1 - line 3 column 1 (char 58 - 100)"

I propose that the above behavior be retained but:

    echo -e '{"ingredients":["frog", "water", "chocolate", "glucose"]}\n{"ingredients":"chocolate","steel bolts"}' | python3.7 -m json.tool --jsonlines

Should print:
{
    "ingredients": [
        "frog",
        "water",
        "chocolate",
        "glucose"
    ]
}
{
    "ingredients": [
        "chocolate",
        "steel bolts"
    ]
}

If someone else agrees this is an appropriate enhancement, I can start work on a PR in a couple of weeks.
History
Date User Action Args
2017-09-22 16:41:06Eric Moyersetrecipients: + Eric Moyer
2017-09-22 16:41:06Eric Moyersetmessageid: <1506098466.58.0.224432895447.issue31553@psf.upfronthosting.co.za>
2017-09-22 16:41:06Eric Moyerlinkissue31553 messages
2017-09-22 16:41:06Eric Moyercreate