Getting the object array index in jq
问题 I have a json object that looks like this (prodused by i3-msg -t get_workspaces . [ { "name": "1", "urgent": false }, { "name": "2", "urgent": false }, { "name": "something", "urgent": false } ] I am trying to use jq to figure out which index number in the list is based on a select query. jq have something called index() , but it seams to support only strings? Using something like i3-msg -t get_workspaces | jq '.[] | select(.name=="something")' gives me the object I want. But I want it's