title: How to filter dictionaries in Jinja?
body: <p>I have a dictionary of packages with package-name being the <em>key</em> and a dictionary of some details being the <em>value</em>:</p>
  
  <pre class="lang-js prettyprint-override"><code>{
          "php7.1-readline": {
              "latest": "7.1.9-1+ubuntu14.04.1+deb.sury.org+1", 
              "origins": [
                  "ppa.launchpad.net"
              ], 
              "version": "7.1.6-2~ubuntu14.04.1+deb.sury.org+1", 
              "www": "http://www.php.net/"
          }, 
          "php7.1-xml": {
              "latest": "7.1.9-1+ubuntu14.04.1+deb.sury.org+1", 
              "origins": [
                  "ppa.launchpad.net"
              ], 
              "version": "7.1.6-2~ubuntu14.04.1+deb.sury.org+1", 
              "www": "http://www.php.net/"
          }, 
          "plymouth": {
              "version": "0.8.8-0ubuntu17.1"
          },
      ....
  }
  </code></pre>
  
  <p>I'd like to reduce the above to a dictionary with only the packages, that have the <code>latest</code>-attribute in their values.</p>
  
  <p>It would seem like <code>json_query</code> is the filter to use, but I can't figure out the syntax. The examples out there all seem to operate on <em>lists</em> of dictionaries, not <em>dictionaries</em> of same...</p>
  
  <p>For example, if I "pipe" the above dictionary into <code>json_query('*.latest')</code>, I get the <em>list</em> of the actual latest versions:</p>
  
  <pre><code>[
    "7.1.9-1+ubuntu14.04.1+deb.sury.org+1",
    "7.1.9-1+ubuntu14.04.1+deb.sury.org+1",
    "7.1.6-2~ubuntu14.04.1+deb.sury.org+1"
  ]
  </code></pre>
  
  <p>How can I get the entire dictionary-elements instead?</p>
  
  <p>Any hope?</p>