Loop over JSON array

This example will print all of the values associated with the name key:

sample='[{"name":"foo"},{"name":"bar"}]'
for row in $(echo "${sample}" | jq -r '.[] | @base64'); do
    echo ${row} | base64 --decode | jq -r '.name'
done

Resource: https://www.starkandwayne.com/blog/bash-for-loop-over-json-array-using-jq/

Get object based on value of JSON variable

jq '.[] | select(.location=="Stockholm")' json
{
  "location": "Stockholm",
  "name": "Walt"
}
{
  "location": "Stockholm",
  "name": "Donald"
}

Resource: https://stackoverflow.com/questions/18592173/select-objects-based-on-value-of-variable-in-object-using-jq

Get keys of object

jq 'keys' blob.json

Get values of array object

jq '.[] | values' blob.json