title: JQ: Convert Array to Array, access upper elements and position
body: <p>I got the following source:</p>
  <pre><code>{
      &quot;id&quot;: &quot;FOO11100&quot;,
      &quot;Published&quot;: {
          &quot;$date&quot;: &quot;2020-04-02T15:15:00Z&quot;
      },
      &quot;Modified&quot;: {
          &quot;$date&quot;: &quot;2020-12-24T16:15:00Z&quot;
      },
      &quot;last-modified&quot;: {
          &quot;$date&quot;: &quot;2020-12-24T16:15:00Z&quot;
      },
      &quot;access&quot;: {
          &quot;authentication&quot;: &quot;SINGLE&quot;,
          &quot;complexity&quot;: &quot;LOW&quot;,
          &quot;vector&quot;: &quot;NETWORK&quot;
      },
      &quot;available_product&quot;: [
          &quot;custom:foo:a:roxy:1.8&quot;,
          &quot;custom:foo:a:roxy:1.9&quot;,
          &quot;custom:foo:o:ianu:10.0&quot;
      ]
  }
  </code></pre>
  <p>I want to get something like that:</p>
  <pre><code>{
    &quot;entries&quot;: [
    {
      &quot;parent&quot;: {
        &quot;processid&quot;: &quot;FOO11100&quot;,
        &quot;published&quot;: &quot;2020-04-02T15:15:00Z&quot;,
        &quot;modified&quot;: &quot;2020-12-24T16:15:00Z&quot;,
        &quot;access_authentication&quot;: &quot;SINGLE&quot;,
        &quot;access_complexity&quot;: &quot;LOW&quot;,
        &quot;access_vector&quot;: &quot;NETWORK&quot;
      },
      &quot;childs&quot;: [
          {
            &quot;processid&quot;: &quot;FOO11100&quot;,
            &quot;childid&quot;: 1,
            &quot;type&quot;: &quot;Application&quot;,
            &quot;name&quot;: &quot;roxy&quot;,
            &quot;score&quot;: &quot;1.8&quot;,
            &quot;lastupdate&quot;: &quot;2020-12-24T16:15:00Z&quot;
          },
          {
            &quot;processid&quot;: &quot;FOO11100&quot;,
            &quot;childid&quot;: 2,
            &quot;type&quot;: &quot;Application&quot;,
            &quot;name&quot;: &quot;roxy&quot;,
            &quot;score&quot;: &quot;1.9&quot;,
            &quot;lastupdate&quot;: &quot;2020-12-24T16:15:00Z&quot;
          },
          {
            &quot;processid&quot;: &quot;FOO11100&quot;,
            &quot;childid&quot;: 3,
            &quot;type&quot;: &quot;Operation&quot;,
            &quot;name&quot;: &quot;ianu&quot;,
            &quot;score&quot;: &quot;10.0&quot;,
            &quot;lastupdate&quot;: &quot;2020-12-24T16:15:00Z&quot;
          }
        ]
      }
    ]
  }
  </code></pre>
  <p>The upper part is no problem, but in the lower part I want to iterate over the elements within .available_product and access:</p>
  <ul>
  <li>id and last-modified outside of the array for processid and lastupdate within the new object</li>
  <li>the position of the element within the array for childid</li>
  <li>the tokenized text part 3 to translate it (a=Application, o=Operation)</li>
  </ul>
  <p>Currently i have that:</p>
  <pre><code>{entries: 
   [
    { parent: 
     {
      processid: .id, 
      published: .Published.&quot;$date&quot;, 
      modified: .&quot;last-modified&quot;.&quot;$date&quot;, 
      access_authentication: .access.authentication, 
      access_complexity: .access.complexity, 
      access_vector: .access.vector
     }, 
     childs: .available_product
    }
   ]
  }
  </code></pre>
  <p>but I dont have any luck with the array processing.</p>
  <p>any help appreciated</p>