title: jq: how to loop through sub arrays
body: <p>I'm having the following dataset:</p>
  <pre><code>{
    &quot;data&quot;: {
      &quot;activeFindings&quot;: {
        &quot;findings&quot;: [
          {
            &quot;findingId&quot;: &quot;someFindingID#84209&quot;,
            &quot;products&quot;: [
              &quot;hostA.corp.somedomain.org&quot;,
              &quot;hostB.corp.somedomain.org&quot;
            ],
            &quot;totalAffectedObjectsCount&quot;: 6
          },
          {
            &quot;findingId&quot;: &quot;someFindingID#2145016&quot;,
            &quot;products&quot;: [
              &quot;hostC.corp.somedomain.org&quot;
            ],
            &quot;totalAffectedObjectsCount&quot;: 1
          },
          {
            &quot;findingId&quot;: &quot;someFindingID#67129&quot;,
            &quot;products&quot;: [
              &quot;hostD.corp.somedomain.org&quot;
            ],
            &quot;totalAffectedObjectsCount&quot;: 4
          },
          {
            &quot;findingId&quot;: &quot;someFindingID#67774&quot;,
            &quot;products&quot;: [
              &quot;hostA.corp.somedomain.org&quot;
            ],
            &quot;totalAffectedObjectsCount&quot;: 6
          }
        ]
      }
    }
  }
  </code></pre>
  <p>The following command (though the first result returns null) will give the list of <strong>findingID</strong> and its associated host(s):</p>
  <pre><code>cat test | jq -r '.data[] | .. | &quot;\(.findingId?) \(.products?)&quot;'
  null null
  someFindingID#84209 [&quot;hostA.corp.somedomain.org&quot;,&quot;hostB.corp.somedomain.org&quot;]
  someFindingID#2145016 [&quot;hostC.corp.somedomain.org&quot;,&quot;hostE.corp.somedomain.org&quot;,&quot;hostG.corp.somedomain.org&quot;]
  someFindingID#67129 [&quot;hostD.corp.somedomain.org&quot;]
  someFindingID#67774 [&quot;hostA.corp.somedomain.org&quot;]
  </code></pre>
  <p>What I'd like to achieve is to loop through each values and pass the <strong>findingId</strong> &amp; <strong>products</strong> as arguments in a bash script.</p>
  <p>The following:</p>
  <pre><code>someFindingID#84209 [&quot;hostA.corp.somedomain.org&quot;,&quot;hostB.corp.somedomain.org&quot;]
  someFindingID#2145016 [&quot;hostC.corp.somedomain.org&quot;,&quot;hostE.corp.somedomain.org&quot;,&quot;hostG.corp.somedomain.org&quot;]
  someFindingID#67129 [&quot;hostD.corp.somedomain.org&quot;]
  someFindingID#67774 [&quot;hostA.corp.somedomain.org&quot;]
  </code></pre>
  <p>Would result in:</p>
  <pre><code>./somescript.sh someFindingID#84209 hostA.corp.somedomain.org
  ./somescript.sh someFindingID#84209 hostB.corp.somedomain.org
  ./somescript.sh someFindingID#2145016 hostC.corp.somedomain.org
  ./somescript.sh someFindingID#2145016 hostE.corp.somedomain.org
  ./somescript.sh someFindingID#2145016 hostG.corp.somedomain.org
  ./somescript.sh someFindingID#67129 hostD.corp.somedomain.org
  [...]
  </code></pre>
  <p>Any help/guidance on how to achieve the above would be greatly appreciated!</p>
  <p>Thanks,</p>