Search notes:

jq: the .[] filter

$ echo '[ "Hello world", 42, null, "foo, bar baz" ]' | jq .[]
"Hello world"
42
null
"foo, bar baz"
Find a specific object in an array of objects. The following query returns 17:
echo '[
  {"id": 42,  "txt": "Hello world"},
  {"id": 99,  "txt": "ninety-nine"},
  {"id": 17,  "txt": "Find me"    },
  {"id":  1,  "txt": "The first"  }
]' | jq '
    .[] | 
   select ( .txt == "Find me" ) |
   .id '

See also

jq

Index