title: how to use jq to filter an object based on it's key:value pair?
body: <p>Assuming this is the input</p>
  <pre><code>&gt;echo '{&quot;A&quot;: {&quot;x&quot;: 1}, &quot;B&quot;: {&quot;x&quot;:2}, &quot;C&quot;:{&quot;x&quot;:3}}' | jq '.'
  {
    &quot;A&quot;: {
      &quot;x&quot;: 1
    },
    &quot;B&quot;: {
      &quot;x&quot;: 2
    },
    &quot;C&quot;: {
      &quot;x&quot;: 3
    }
  }
  </code></pre>
  <p>I would like to get the return object of <code>&quot;x&quot; == 2</code>.
  The only way i know of how to achieve that is thru this</p>
  <pre><code>&gt;echo '{&quot;A&quot;: {&quot;x&quot;: 1}, &quot;B&quot;: {&quot;x&quot;:2}, &quot;C&quot;:{&quot;x&quot;:3}}' | jq '.[] | select(.x==2)'
  {
    &quot;x&quot;: 2
  }
  </code></pre>
  <p>Is there a way to have jq return me like this instead?</p>
  <pre><code>{
    &quot;B&quot;: {
      &quot;x&quot;: 2
    },
  }
  
   
  </code></pre>