title: Getting sum of values from object in array using jq
body: <p>I'm trying to get the total amount for a specific value in a array.
  The input would be something like</p>
  
  <pre><code>[{
      "name": "mars",
      "runner":  [
          {
          "foo": null,
          "idle": true
          },
          {
          "foo": null,
          "idle": true
          },
          {
          "foo": null,
          "idle": false
          }
  
      ],
          "name": "june",
          "runner": [
          {
          "foo": null,
          "idle": true
          },
          {
          "foo": null,
          "idle": true
          },
          {
          "foo": null,
          "idle": true
          }
      ]
  }]
  </code></pre>
  
  <p>The desired output</p>
  
  <blockquote>
    <p>[ {"name" : "mars", "idle" : 2"},{"name" : "june", "idle" : 1"} ]</p>
  </blockquote>
  
  <p>I tried using select and map, but I'm not understanding exactly how jq is working, for instance, I tried the following query</p>
  
  <pre><code>jq  ' .[] | select(.runner[].idle == true) | {name: .name}'
  </code></pre>
  
  <p>The result was</p>
  
  <blockquote>
    <p>{   "nome": "mars" } {   "nome": "mars" } {   "nome": "june" } {<br>
    "nome": "june" } {   "nome": "june" }</p>
  </blockquote>
  
  <p>(3x true in june and 2x in mars) I can keep parsing the json and get to the result I want, but it doesn't seems right.</p>