There is an array of json object, using jq how to check if an object exists if so returns the true else false
I tried this but getting error
cat fruits.json | jq '.fruits[]| sort_by(.version)'
I would like to sort by decending order and output the price of the most recent version.
{
"fruits": [
{
"name": "banana",
"color": "yellow",
"price": 0.51,
"version": 1
},
{
"name": "banana",
"color": "yellow",
"price": 0.52,
"version": 2
}
]
}