title: Filter object by property and select with key in jmespath
body: <p>I'm trying to filter properties of an object in <a href="https://stackoverflow.com/tags/jmespath/info">jmespath</a> based on the value of a subproperty and want to include only those properties where the subproperty is set to a specific value.</p>
  
  <p>Based on this example data:</p>
  
  <pre><code>{
    "a": {
      "feature": {
        "enabled": true,
      }
    },
    "b": {
    },
    "c": {
      "feature": {
        "enabled": false
       }
    }
  }
  </code></pre>
  
  <p>I'd like to get an object with all properties where the feature is enabled.</p>
  
  <pre><code>{
    "a": {
      "feature": {
        "enabled": true,
      }
    }
  }
  </code></pre>
  
  <p>I figured I could use this jmespath query to filter the objects where <code>property. enabled</code> is set to true. Unfortunateley, it doesn't seem to work and instead returns an empty array.</p>
  
  <pre><code>*[?feature.enabled==`true`]
  </code></pre>
  
  <p><code>*.feature.enabled</code> or <code>*[feature.enabled]</code> return just the boolean values without any context.</p>
  
  <p>Even if <code>*[?feature.enabled==</code>true<code>]</code> would work, it would just be an array of the property values, but I need the keys (<code>a</code> and <code>c</code>) aswell. Is there any way to make this happen in jmespath?</p>
  
  <p>This is all part of an ansible playbook, so there would certainly be a way to achieve selection in a different way (Jinja2 templates or custom plugin) but I wanted to try jmespath and would reason, that it should be capable of such a task.</p>