JMESPath如何分组和汇总数据
输入数据:
[
{
"name" : "app1",
"summary_value" : 40
},
{
"name" : "app2",
"summary_value" : 75
},
]
预期结果:
Script error.
我尝试过的想法:
它尝试在下面的代码下执行,但不起作用,并返回const testData =
[
{
"value" : 15,
"name" : "app1"
},
{
"value" : 25,
"name" : "app1"
},
{
"value" : 30,
"name" : "app2"
},
{
"value" : 45,
"name" : "app2"
}
];
console.log( jmespath.search(testData, '[].{name:name,summary_value:sum([?name = name].value)}') );
消息
Set list2 = .Document.querySelectorAll("#main_table")
Demo - JSFiddle - Code Playground
PS:我的环境是ubuntu并支持bash