I have following JSON:
{
"groupId1" : {
"list" : [
{
"field1": "somevalue",
"count": 2,
"field3": "somevalue"
},
{
"field1": "somevalue",
"count": 3,
"field3": "somevalue"
}
]
},
"groupId2" : {
"list" : [
{
"field1": "somevalue",
"count": 0,
"field3": "somevalue"
},
{
"field1": "somevalue",
"count": 4,
"field3": "somevalue"
}
]
},
...
}
And result i want to achieve(using jq) is:
[
"groupId1":5,
"groupId2":4
]
Each group has exactly one "list" element.
I understand that i shoud use group by and sum, but i can't get it work.