title: Moving one array into json objects defined in another array - JOLT Transformation
body: <p>I have my input defined as</p>
  <pre><code>{
      &quot;lineId&quot;: &quot;1&quot;,
      &quot;Collection&quot;: {
          &quot;services&quot;: [
              {
                  &quot;Code&quot;: &quot;TB&quot;,
                  &quot;Type&quot;: [
                      &quot;Data&quot;
                  ]
              },
              {
                  &quot;Code&quot;: &quot;MAGTB&quot;,
                  &quot;Type&quot;: [
                      &quot;Data&quot;
                  ]
              }
          ]
      },
      &quot;promotions&quot;: [
          {
              &quot;Id&quot;: &quot;1&quot;
          },
          {
              &quot;Id&quot;: &quot;2&quot;
          }
      ]
  }
  </code></pre>
  <p>I would like to get my output as</p>
  <pre><code>{
      &quot;lineId&quot;: &quot;1&quot;,
      &quot;Collection&quot;: {
          &quot;services&quot;: [
              {
                  &quot;Code&quot;: &quot;TB&quot;,
                  &quot;Type&quot;: [
                      &quot;Data&quot;
                  ],
                  &quot;promotions&quot;: [
                      {
                          &quot;Id&quot;: &quot;1&quot;
                      },
                      {
                          &quot;Id&quot;: &quot;2&quot;
                      }
                  ]
              },
              {
                  &quot;Code&quot;: &quot;TB2&quot;,
                  &quot;Type&quot;: [
                      &quot;Data&quot;
                  ],
                  &quot;promotions&quot;: [
                      {
                          &quot;Id&quot;: &quot;1&quot;
                      },
                      {
                          &quot;Id&quot;: &quot;2&quot;
                      }
                  ]
              }
          ]
      }
  }
  </code></pre>
  <p>Any help would be appreciated.</p>
  <p>I am new to JOLT. And I'm having trouble navigating to the second array from inside the first.</p>
  <p>Incomplete transformation that I tried:</p>
  <pre><code>[
    {
      &quot;operation&quot;: &quot;shift&quot;,
      &quot;spec&quot;: {
        &quot;Collection&quot;: {
          &quot;services&quot;: {
       
            &quot;*&quot;: &quot;Collection.services[].&amp;&quot;,
            &quot;@(3,lineId)&quot;: &quot;lineId&quot;,
            &quot;@(3,promotions)&quot;:{
              &quot;*&quot;:
            }
          }
        }
      }
    }
  ]
  </code></pre>
  <p>edit: Tried this now</p>
  <pre><code>[
    {
      &quot;operation&quot;: &quot;shift&quot;,
      &quot;spec&quot;: {
        &quot;Collection&quot;: {
          &quot;services&quot;: {
            &quot;*&quot;: &quot;Collection.services[]&quot;,
            //  &quot;*&quot;: &quot;&amp;&quot;,
            &quot;@(3,lineId)&quot;: &quot;lineId&quot;,
            &quot;@(3,promotions)&quot;: {
              &quot;*&quot;: {
                &quot;Id&quot;: &quot;Id&quot;
              }
            }
          }
        }
      }
    }
  ]
  </code></pre>
  <p>I just have to figure out a way to move the Id list inside the objects in services array.</p>
  <p>edit2:</p>
  <pre><code>[
    {
      &quot;operation&quot;: &quot;shift&quot;,
      &quot;spec&quot;: {
        &quot;Collection&quot;: {
          &quot;services&quot;: {
            &quot;*&quot;: {
              &quot;*&quot;: &quot;Collection.services[&amp;1].&amp;&quot;,
              &quot;@(3,lineId)&quot;: &quot;Collection.services[&amp;1].lineId&quot;,
              &quot;@(3,promotions)&quot;: &quot;Collection.services[&amp;1].promotions&quot;
            }
          }
        }
      }
    }
  ]
  </code></pre>