On Thu, Dec 17, 2020 at 11:31 PM Penelope Fudd <parallel@ch.pkts.ca> wrote:
[ ... I want JSON output ... ]
{"Input":["red","cat"],"Stdout":"red cat\n","Stderr":""}
{"Input":["green","cat"],"Stdout":"green cat\n","Stderr":""}
I chose a slightly different format: The new JSON output mode is
basically a rip-off of the CSV-mode.
$ seq 3 | parallel --results -.json seq {}
{ "Seq": 1, "Host": ":", "Starttime": 1608558088.369, "JobRuntime":
0.003, "Send": 0, "Rec
eive": 2, "Exitval": 0, "Signal": 0, "Command": "seq 1", "V": [ "1" ],
"Stdout": "1\u000a"
, "Stderr": "" }
{ "Seq": 2, "Host": ":", "Starttime": 1608558088.372, "JobRuntime":
0.003, "Send": 0, "Rec
eive": 4, "Exitval": 0, "Signal": 0, "Command": "seq 2", "V": [ "2" ],
"Stdout": "1\u000a2
\u000a", "Stderr": "" }
{ "Seq": 3, "Host": ":", "Starttime": 1608558088.376, "JobRuntime":
0.004, "Send": 0, "Rec
eive": 6, "Exitval": 0, "Signal": 0, "Command": "seq 3", "V": [ "3" ],
"Stdout": "1\u000a2
\u000a3\u000a", "Stderr": "" }
Piped through 'jq .':
{
"Seq": 3,
"Host": ":",
"Starttime": 1608558118.154,
"JobRuntime": 0.003,
"Send": 0,
"Receive": 6,
"Exitval": 0,
"Signal": 0,
"Command": "seq 3",
"V": [
"3"
],
"Stdout": "1\n2\n3\n",
"Stderr": ""
}
--results -.json is alpha quality so feedback is encouraged.
/Ole