title: Combining two arrays and transformation using Jolt
body: <p>I am having a tough time using Jolt mapping trying to transform the input to the necessary form</p>
  <p>Input JSON</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;data&quot;: [
      {
        &quot;name&quot;: &quot;Alcohol&quot;,
        &quot;collection_id&quot;: 123,
        &quot;properties&quot;: [
          {
            &quot;name&quot;: &quot;Tax&quot;,
            &quot;property_id&quot;: &quot;00001&quot;
          },
          {
            &quot;name&quot;: &quot;Expenditure&quot;,
            &quot;property_id&quot;: &quot;00002&quot;
          }
        ],
        &quot;attributes&quot;: [
          {
            &quot;name&quot;: &quot;alcohol_tax&quot;,
            &quot;attribute_id&quot;: &quot;00011&quot;
          },
          {
            &quot;name&quot;: &quot;alcohol_expenditure&quot;,
            &quot;attribute_id&quot;: &quot;00022&quot;
          }
        ]
      }
    ]
  }
  </code></pre>
  <p>Output JSON</p>
  <pre class="lang-json prettyprint-override"><code>[
      {
          &quot;name&quot;: &quot;Alcohol&quot;,
          &quot;collection_id&quot;: 123,
          &quot;details&quot;: [{
                  &quot;property_name&quot;: &quot;Tax&quot;,
                  &quot;property_id&quot;: &quot;00001&quot;,
                  &quot;attribute_id&quot;: &quot;00011&quot;
              },
              {
                  &quot;property_name&quot;: &quot;Expenditure&quot;,
                  &quot;property_id&quot;: &quot;00002&quot;,
                  &quot;attribute_id&quot;: &quot;00022&quot;
              }
          ]
      }
  ]
  </code></pre>
  <p>I have tried a couple of ways to combine the arrays using a few rules but with little success.</p>
  <p>One of the rules</p>
  <pre class="lang-json prettyprint-override"><code>[{
      &quot;operation&quot;: &quot;shift&quot;,
      &quot;spec&quot;: {
        &quot;data&quot;: {
          &quot;*&quot;: {
            &quot;name&quot;: &quot;&amp;1.name&quot;,
            &quot;collection_id&quot;: &quot;&amp;1.collection_id&quot;,
            &quot;attributes&quot;: {
              &quot;*&quot;: {
                &quot;attribute_id&quot;: &quot;&amp;1.attribute_id[]&quot;
              }
            },
            &quot;properties&quot;: {
              &quot;*&quot;: {
                &quot;name&quot;: &quot;&amp;1.myname[]&quot;,
                &quot;property_id&quot;: &quot;&amp;1.property_id[]&quot;
              }
            }
          }
        }
      }
  }]
  </code></pre>
  <p>is adding all the attributes and properties to all the collections.I do not know why this happens as I thought &amp;1.property_id[] would only add items in that particular collection to the array and not all collections. Any help/clues on why this is happening would be truly appreciated.</p>