<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: jolt transform ( add array elements to a different existing array ) in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/jolt-transform-add-array-elements-to-a-different-existing/m-p/365925#M239441</link>
    <description>&lt;P&gt;Hi Samsal - that's perfect. Many thanks , Rob &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 11 Mar 2023 19:00:20 GMT</pubDate>
    <dc:creator>rob1</dc:creator>
    <dc:date>2023-03-11T19:00:20Z</dc:date>
    <item>
      <title>jolt transform ( add array elements to a different existing array )</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jolt-transform-add-array-elements-to-a-different-existing/m-p/365719#M239375</link>
      <description>&lt;P&gt;Hello , can anyone help with a spec to transform this JSON input to the desired output .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;JSON INPUT&lt;/P&gt;&lt;P&gt;==========&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"saleStrategy": {&lt;BR /&gt;"strategy": "strategy1",&lt;BR /&gt;"code": "code1"&lt;BR /&gt;},&lt;BR /&gt;"saleStrategyCollection": [&lt;BR /&gt;{&lt;BR /&gt;"id": "2",&lt;BR /&gt;"saleStrategy": {&lt;BR /&gt;"strategy": "strategy2",&lt;BR /&gt;"code": "code2"&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"id": "3",&lt;BR /&gt;"saleStrategy": {&lt;BR /&gt;"strategy": "strategy3",&lt;BR /&gt;"code": "code3"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;== desired output json ==&lt;BR /&gt;{&lt;BR /&gt;"saleStrategies" : [&lt;BR /&gt;{&lt;BR /&gt;"strategy" : "strategy1",&lt;BR /&gt;"code" : "code1"&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"strategy" : "strategy2",&lt;BR /&gt;"code" : "code2"&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"strategy" : "strategy3",&lt;BR /&gt;"code" : "code3"&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;== current spec === // this currently only transforms the initial single saleStrategy object to an array called salesStrategies. Desired output above shows that If there is a saleStrategy array also present in the input JSON , then the spec needs to add the saleStrategy objects within that array to the salesStrategies output array as well . NOTE the transform must not include "id" in the output.&lt;/P&gt;&lt;P&gt;[&lt;BR /&gt;{&lt;BR /&gt;"operation": "shift",&lt;BR /&gt;"spec": {&lt;BR /&gt;"saleStrategy": {&lt;BR /&gt;"strategy": "saleStrategies[0].strategy",&lt;BR /&gt;"code": "saleStrategies[0].code"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;]&lt;/P&gt;&lt;P&gt;Any suggestions would be greatly appreciated. Thanks in advance, Rob.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 22:44:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jolt-transform-add-array-elements-to-a-different-existing/m-p/365719#M239375</guid>
      <dc:creator>rob1</dc:creator>
      <dc:date>2023-03-08T22:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: jolt transform ( add array elements to a different existing array )</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jolt-transform-add-array-elements-to-a-different-existing/m-p/365720#M239376</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/103894"&gt;@rob1&lt;/a&gt;&amp;nbsp;Welcome to the Cloudera Community!&lt;BR /&gt;&lt;BR /&gt;I noticed that your post may be related to NiFI. To help you get the best possible solution, I have tagged our NiFi experts&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp; and &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;who may be able to assist you further.&lt;BR /&gt;&lt;BR /&gt;Please keep us updated on your post, and we hope you find a satisfactory solution to your query.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 23:28:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jolt-transform-add-array-elements-to-a-different-existing/m-p/365720#M239376</guid>
      <dc:creator>DianaTorres</dc:creator>
      <dc:date>2023-03-08T23:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: jolt transform ( add array elements to a different existing array )</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jolt-transform-add-array-elements-to-a-different-existing/m-p/365745#M239383</link>
      <description>&lt;P&gt;Thanks Diana I'll look out for their reply.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 08:13:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jolt-transform-add-array-elements-to-a-different-existing/m-p/365745#M239383</guid>
      <dc:creator>rob1</dc:creator>
      <dc:date>2023-03-09T08:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: jolt transform ( add array elements to a different existing array )</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jolt-transform-add-array-elements-to-a-different-existing/m-p/365781#M239387</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/103894"&gt;@rob1&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;Please try the following transformation:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  // first shift will group all strategies under one collection: saleStrategyCollection 
  {
    "operation": "shift",
    "spec": {
      "saleStrategyCollection": "&amp;amp;",
      "saleStrategy": "saleStrategyCollection[].&amp;amp;"
    }
  },
  // 2ed shift will bucket each strategy &amp;amp; code as an array item ([&amp;amp;2]=0,1,2..)
  // under saleStrategies collection and use the same key (&amp;amp;)
  {
    "operation": "shift",
    "spec": {
      "saleStrategyCollection": {
        "*": { // level 2 = 0,1,2..
          "saleStrategy": { //level 1
            "strategy": "saleStrategies[&amp;amp;2].&amp;amp;", //level 0
            "code": "saleStrategies[&amp;amp;2].&amp;amp;"
          }
        }
      }
    }
  }
  ]&lt;/LI-CODE&gt;&lt;P&gt;If that helps, please accept solution.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 16:11:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jolt-transform-add-array-elements-to-a-different-existing/m-p/365781#M239387</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-03-09T16:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: jolt transform ( add array elements to a different existing array )</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jolt-transform-add-array-elements-to-a-different-existing/m-p/365925#M239441</link>
      <description>&lt;P&gt;Hi Samsal - that's perfect. Many thanks , Rob &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2023 19:00:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jolt-transform-add-array-elements-to-a-different-existing/m-p/365925#M239441</guid>
      <dc:creator>rob1</dc:creator>
      <dc:date>2023-03-11T19:00:20Z</dc:date>
    </item>
  </channel>
</rss>

