Let's say I have the following json. I want to get all the items where the "employee" had different teams over the year.
[
{
"id": 122343,
"name": "Tom Muller",
"teams": [
{
"year": "2010-2011",
"team_id": 27
},
{
"year": "2011-2012",
"team_id": 27
},
{
"year": "2013-2014",
"team_id": 27
}
]
},
{
"id": 338744,
"name": "Eric Gonzales",
"teams": [
{
"year": "2010-2011",
"team_id": 12
},
{
"year": "2011-2012",
"team_id": 17
},
{
"year": "2013-2014",
"team_id": 17
}
]
}
]
I would like to query the array with jq and the output would return
{
"id": 338744,
"name": "Eric Gonzales",
"teams": [
{
"year": "2010-2011",
"team_id": 12
},
{
"year": "2011-2012",
"team_id": 17
},
{
"year": "2013-2014",
"team_id": 17
}
]
}
How would I write such a query ?
Thanks