How can I get the id value if name equals to y
in cli?
JSON input :
{
"items": [
{
"id": "x",
"name": "y"
}
]
}
I've tried this
json file | jq -r '.items | select(.name=="y")
it returns
jq: error (at :1): Cannot index array with string "name"` error
How to retrieve the value of name only via jq?
Thanks!