(.issues[] | {key, status: .fields.status.name, assignee: .fields.assignee.emailAddress})
输出:
{ "key": "SEA-739", "status": "Open", "assignee": null } { "key": "SEA-738", "status": "Resolved", "assignee": "user2@mycompany.com" }
但是我需要解析每一行,但是就密钥组而言,很难确定哪个受让人对应哪个密钥。使用jq可以使一束成行吗?
预期产量:
{ "key": "SEA-739", "status": "Open", "assignee": null } { "key": "SEA-738", "status": "Resolved", "assignee": "user2@mycompany.com"}
要么
{ "SEA-739", "Open", null } { "SEA-738", "Resolved", user2@mycompany.com }
-c 您可能需要的是
-c
使用上面发布的输出,可以进行进一步处理:
jq **-c** 。输入
给予
{"key":"SEA-739","status":"Open","assignee":null} {"key":"SEA-738","status":"Resolved","assignee":"user2@mycompany.com"}
或者您可以只更改原始命令
从
jq **-r** '(.issues [] | {键,状态:.fields.status.name,受让人:.fields.assignee.emailAddress})'
至
jq **-c** '(.issues [] | {键,状态:.fields.status.name,受让人:.fields.assignee.emailAddress})'