【发布时间】:2021-09-18 19:38:42
【问题描述】:
我使用以下命令将 stickyType 的 curl 响应分组:
curl <url> | jq 'group_by(.stickyType)'
它给出了以下输出:
[
[
{
"stickyType": "TypeA",
"content": "X",
},
{
"stickyType": "TypeA",
"content": "Y",
}
],
[
{
"stickyType": "TypeB",
"content": "Z",
}
]
]
现在我想将其打印为:
TypeA
1. X
2. Y
TypeB
1. Z
我该怎么做?
【问题讨论】:
-
不需要编号。
-
你能分享整个json吗?