title: How to use jq to produce a cartesian product of two arrays present in the input JSON
body: <p>I'd like to be able to use <code>jq</code> to output the 'product' of 2 arrays in the input JSON... for example, given the following input JSON:</p>
  
  <pre><code> {
       "quantities": [
           {
               "product": "A",
               "quantity": 30
           },
           {
               "product": "B",
               "quantity": 10
           }
           ],
       "portions": [
           {
               "customer": "C1",
               "percentage": .6
           },
           {
               "customer": "C2",
               "percentage": .4
           }
       ]
   }
  </code></pre>
  
  <p>I'd like to produce the following output (or similar...):</p>
  
  <pre><code>[
      {
       "customer": "C1",
       "quantities": [
           {
               "product": "A",
               "quantity": 18
           },
           {
               "product": "B",
               "quantity": 6
           }
           ]
      },
      {
       "customer": "C2",
       "quantities": [
           {
               "product": "A",
               "quantity": 12
           },
           {
               "product": "B",
               "quantity": 4
           }
           ]
      }
  ]
  </code></pre>
  
  <p>So in other words, for each portion, use its value of percentage, and apply it to each product quantity.  Given 2 quantities and 2 portions should yield 4 results.. given 3 quantities and 2 portions should yield 6 results, etc...</p>
  
  <p>I've made some attempts using <code>foreach</code> filters, but to no avail...</p>