Message302755
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. |
|
Date |
User |
Action |
Args |
2017-09-22 16:41:06 | Eric Moyer | set | recipients:
+ Eric Moyer |
2017-09-22 16:41:06 | Eric Moyer | set | messageid: <1506098466.58.0.224432895447.issue31553@psf.upfronthosting.co.za> |
2017-09-22 16:41:06 | Eric Moyer | link | issue31553 messages |
2017-09-22 16:41:06 | Eric Moyer | create | |
|