title: Select objects based on value of variable in object using jq
body: <p>I have the following json file:</p>
  <pre><code>{
      &quot;FOO&quot;: {
          &quot;name&quot;: &quot;Donald&quot;,
          &quot;location&quot;: &quot;Stockholm&quot;
      },
      &quot;BAR&quot;: {
          &quot;name&quot;: &quot;Walt&quot;,
          &quot;location&quot;: &quot;Stockholm&quot;
      },
      &quot;BAZ&quot;: {
          &quot;name&quot;: &quot;Jack&quot;,
          &quot;location&quot;: &quot;Whereever&quot;
      }
  }
  </code></pre>
  <p>I am using jq and want to get the &quot;name&quot; elements of the objects where 'location' is 'Stockholm'.</p>
  <p>I know I can get all names by</p>
  <pre><code>cat json | jq .[] | jq .&quot;name&quot;
  &quot;Jack&quot;
  &quot;Walt&quot;
  &quot;Donald&quot;
  </code></pre>
  <p>But I can't figure out how to print only certain objects, given the value of a sub key (here: <code>&quot;location&quot; : &quot;Stockholm&quot;</code>).</p>