Your proposed solution is fine, but if you don't mind converting the arrays of Key-Value pairs into objects, then the following can be used:map( .Tags |= from_entries ) | group_by(.Tags.Name)这至少使"group_by"易于理解;此外,将.Tags对象转换回键值对(使用小写的键"和值")将很容易:This at least makes the "group_by" easy to understand; furthermore, it would be easy to convert the .Tags objects back to key-value pairs (with lower-case "key" and "value"):map( .Tags |= from_entries ) | group_by(.Tags.Name)| map(map( .Tags |= to_entries))键/值大小写恢复大写键/值标签的一种方法是对上述内容进行如下调整:Key/Value capitalizationOne way to recover the capitalized Key/Value tags would be to tweak the above as follows:def KV: map( {Key: .key, Value: .value} );map( .Tags |= from_entries ) | group_by(.Tags.Name)| map(map( .Tags |= (to_entries | KV))) 这篇关于jq按属性分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-05 06:53