I am trying to get a value from the Json using JQ.
I have to get a ID from the inputJson , (activeItem) and use that ID to get the name of the element from list of items below.
Can this be done in single query ?
{
"amazon": {
"activeitem" : 2,
"items": [
{
"id" : 1,
"name": "harry potter",
"state": "sold"
},
{
"id" : 2,
"name": "adidas shoes",
"state": "in inventory"
},
{
"id" : 3,
"name": "watch",
"state": "returned"
}
]
}
}
Now i am getting the value first and the filtering, instead i want to do in single query.