【发布时间】:2020-04-07 11:59:25
【问题描述】:
我有这个
[
{
"title": "foo",
"label": [
"bar-one",
"bare-two"
]
},
{
"title": "foo_42",
"label": [
"bar-one",
"bare-two"
]
},
{
"title": "foo_42",
"label": [
"bar-one"
]
}
]
我想计算数组标签中“bar”的出现次数 如果 count > 1 则排除对象(可以在 2part 中)
处理后的前:
[
{
"title": "foo_42",
"label": [
"bar-one"
]
}
]
我尝试了不同的解决方案,基于
How to select items in JQ based on value in array
和
https://github.com/stedolan/jq/issues/861
但我做不到!
【问题讨论】: