<?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: Nifi - Jolt Transform JSON Processor - Create a JSON array by utilizing few fields of exiting JSON and ignore the null attributes while constructing the array in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Nifi-Jolt-Transform-JSON-Processor-Create-a-JSON-array-by/m-p/240180#M201986</link>
    <description>&lt;P&gt;Hey &lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; - Thank you so much for responding, it perfectly worked as I needed. I've a slight change in output of JSON array.&lt;BR /&gt;&lt;BR /&gt;Output JSON Array should always contain "color_*" attribute as "color" always. Below is the sample output that I'm looking for.&lt;BR /&gt;&lt;BR /&gt;Expected Output:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;{&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;  "lastName" : "cgLastName6",&lt;/P&gt;&lt;P&gt;  "gender" : "Male",&lt;/P&gt;&lt;P&gt;  "currentDate" : "20190509",&lt;/P&gt;&lt;P&gt;  "middleInitial" : "D",&lt;/P&gt;&lt;P&gt;  "address_2" : "fake addy 2",&lt;/P&gt;&lt;P&gt;  "mailingZipCode" : "55555",&lt;/P&gt;&lt;P&gt;  "provider_address_1" : "123 fake addy",&lt;/P&gt;&lt;P&gt;  "color_1" : "white",&lt;/P&gt;&lt;P&gt;  "color_2" : "",&lt;/P&gt;&lt;P&gt;  "color_3" : "black",&lt;/P&gt;&lt;P&gt;  "color_4" : "",&lt;/P&gt;&lt;P&gt;  "color_5" : "blue",&lt;/P&gt;&lt;P&gt;  "homeAddress" : "123 fake st",&lt;/P&gt;&lt;P&gt;  "primaryLanguage" : "",&lt;/P&gt;&lt;P&gt;  "country" : "us",&lt;/P&gt;&lt;P&gt;  "colorsLove" : [ {&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;    "color" : "white",&lt;/P&gt;&lt;P&gt;    "date" : "20190905"&lt;/P&gt;&lt;P&gt;  }, {&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;    "color" : "black",&lt;/P&gt;&lt;P&gt;    "date" : "20190905"&lt;/P&gt;&lt;P&gt;  }, {&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;    "color" : "blue",&lt;/P&gt;&lt;P&gt;    "date" : "20190905"&lt;/P&gt;&lt;P&gt;  }]&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
    <pubDate>Sat, 11 May 2019 00:13:25 GMT</pubDate>
    <dc:creator>pradeepraovenna</dc:creator>
    <dc:date>2019-05-11T00:13:25Z</dc:date>
    <item>
      <title>Nifi - Jolt Transform JSON Processor - Create a JSON array by utilizing few fields of exiting JSON and ignore the null attributes while constructing the array</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-Jolt-Transform-JSON-Processor-Create-a-JSON-array-by/m-p/240178#M201984</link>
      <description>&lt;P&gt;I'm a newbie to Nifi and learning eventually. I'm looking to create a JSON array by utilizing 5 fields of 15 fields JSON request by using JoltTransformJSON processor. JSON array must ignore the fields if the value is null/empty. &lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Input:&lt;/P&gt;&lt;P&gt;{&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;  "lastName" : "cgLastName6",&lt;/P&gt;&lt;P&gt;  "gender" : "Male",&lt;/P&gt;&lt;P&gt;  "currentDate" : "20190509",&lt;/P&gt;&lt;P&gt;  "middleInitial" : "D",&lt;/P&gt;&lt;P&gt;  "address_2" : "fake addy 2",&lt;/P&gt;&lt;P&gt;  "mailingZipCode" : "55555",&lt;/P&gt;&lt;P&gt;  "provider_address_1" : "123 fake addy",&lt;/P&gt;&lt;P&gt;  "color_1" : "white",&lt;/P&gt;&lt;P&gt;  "color_2" : "",&lt;/P&gt;&lt;P&gt;  "color_3" : "black",&lt;/P&gt;&lt;P&gt;  "color_4" : "",&lt;/P&gt;&lt;P&gt;  "color_5" : "blue",&lt;/P&gt;&lt;P&gt;  "homeAddress" : "123 fake st",&lt;/P&gt;&lt;P&gt;  "primaryLanguage" : "",&lt;/P&gt;&lt;P&gt;  "country" : "us"&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I'm trying to build JSON array of "color_* "attributes and current date parameter to followed by color. My output should consist of existing input + newly built JSON array which consists of 3 color as the color_2, color_4 are null.&lt;BR /&gt;&lt;BR /&gt;Expected Output:&lt;/P&gt;&lt;P&gt;{&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;  "lastName" : "cgLastName6",&lt;/P&gt;&lt;P&gt;  "gender" : "Male",&lt;/P&gt;&lt;P&gt;  "currentDate" : "20190509",&lt;/P&gt;&lt;P&gt;  "middleInitial" : "D",&lt;/P&gt;&lt;P&gt;  "address_2" : "fake addy 2",&lt;/P&gt;&lt;P&gt;  "mailingZipCode" : "55555",&lt;/P&gt;&lt;P&gt;  "provider_address_1" : "123 fake addy",&lt;/P&gt;&lt;P&gt;  "color_1" : "white",&lt;/P&gt;&lt;P&gt;  "color_2" : "",&lt;/P&gt;&lt;P&gt;  "color_3" : "black",&lt;/P&gt;&lt;P&gt;  "color_4" : "",&lt;/P&gt;&lt;P&gt;  "color_5" : "blue",&lt;/P&gt;&lt;P&gt;  "homeAddress" : "123 fake st",&lt;/P&gt;&lt;P&gt;  "primaryLanguage" : "",&lt;/P&gt;&lt;P&gt;  "country" : "us",&lt;/P&gt;&lt;P&gt;  "colorsLove" : [ {&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;    "color_1" : "white",&lt;/P&gt;&lt;P&gt;    "date" : "20190905"&lt;/P&gt;&lt;P&gt;  }, {&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;    "color_3" : "black",&lt;/P&gt;&lt;P&gt;    "date" : "20190905"&lt;/P&gt;&lt;P&gt;  }, {&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;    "color_5" : "blue",&lt;/P&gt;&lt;P&gt;    "date" : "20190905"&lt;/P&gt;&lt;P&gt;  }]&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 22:48:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-Jolt-Transform-JSON-Processor-Create-a-JSON-array-by/m-p/240178#M201984</guid>
      <dc:creator>pradeepraovenna</dc:creator>
      <dc:date>2019-05-10T22:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi - Jolt Transform JSON Processor - Create a JSON array by utilizing few fields of exiting JSON and ignore the null attributes while constructing the array</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-Jolt-Transform-JSON-Processor-Create-a-JSON-array-by/m-p/240179#M201985</link>
      <description>&lt;P&gt;This Chain spec will add the hardcoded value 20190905 into the array (after removing empty values):&lt;/P&gt;&lt;PRE&gt;[
&amp;nbsp; {
&amp;nbsp; &amp;nbsp; "operation": "shift",
&amp;nbsp; &amp;nbsp; "spec": {
&amp;nbsp; &amp;nbsp; &amp;nbsp; "color_*": {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "": "TRASH",
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "*": {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "$": "colorsLove[].&amp;amp;2"
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; },
&amp;nbsp; &amp;nbsp; &amp;nbsp; "*": "&amp;amp;"
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; },
&amp;nbsp; {
&amp;nbsp; &amp;nbsp; "operation": "shift",
&amp;nbsp; &amp;nbsp; "spec": {
&amp;nbsp; &amp;nbsp; &amp;nbsp; "colorsLove": {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "*": {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "#20190905": "colorsLove[#2].date",
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "*": "colorsLove[#2].&amp;amp;"
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; },
&amp;nbsp; &amp;nbsp; &amp;nbsp; "*": "&amp;amp;"
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; },
&amp;nbsp; {
&amp;nbsp; &amp;nbsp; "operation": "remove",
&amp;nbsp; &amp;nbsp; "spec": {
&amp;nbsp; &amp;nbsp; &amp;nbsp; "TRASH": ""
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; }
]&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;You should be able to replace "#20190905" with a NiFi Expression Language statement, maybe something like:&lt;/P&gt;&lt;PRE&gt;"#${now:toNumber():format('yyyyddMM')}"&lt;/PRE&gt;&lt;P&gt;... but I didn't try that part.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 23:27:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-Jolt-Transform-JSON-Processor-Create-a-JSON-array-by/m-p/240179#M201985</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2019-05-10T23:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi - Jolt Transform JSON Processor - Create a JSON array by utilizing few fields of exiting JSON and ignore the null attributes while constructing the array</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-Jolt-Transform-JSON-Processor-Create-a-JSON-array-by/m-p/240180#M201986</link>
      <description>&lt;P&gt;Hey &lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; - Thank you so much for responding, it perfectly worked as I needed. I've a slight change in output of JSON array.&lt;BR /&gt;&lt;BR /&gt;Output JSON Array should always contain "color_*" attribute as "color" always. Below is the sample output that I'm looking for.&lt;BR /&gt;&lt;BR /&gt;Expected Output:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;{&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;  "lastName" : "cgLastName6",&lt;/P&gt;&lt;P&gt;  "gender" : "Male",&lt;/P&gt;&lt;P&gt;  "currentDate" : "20190509",&lt;/P&gt;&lt;P&gt;  "middleInitial" : "D",&lt;/P&gt;&lt;P&gt;  "address_2" : "fake addy 2",&lt;/P&gt;&lt;P&gt;  "mailingZipCode" : "55555",&lt;/P&gt;&lt;P&gt;  "provider_address_1" : "123 fake addy",&lt;/P&gt;&lt;P&gt;  "color_1" : "white",&lt;/P&gt;&lt;P&gt;  "color_2" : "",&lt;/P&gt;&lt;P&gt;  "color_3" : "black",&lt;/P&gt;&lt;P&gt;  "color_4" : "",&lt;/P&gt;&lt;P&gt;  "color_5" : "blue",&lt;/P&gt;&lt;P&gt;  "homeAddress" : "123 fake st",&lt;/P&gt;&lt;P&gt;  "primaryLanguage" : "",&lt;/P&gt;&lt;P&gt;  "country" : "us",&lt;/P&gt;&lt;P&gt;  "colorsLove" : [ {&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;    "color" : "white",&lt;/P&gt;&lt;P&gt;    "date" : "20190905"&lt;/P&gt;&lt;P&gt;  }, {&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;    "color" : "black",&lt;/P&gt;&lt;P&gt;    "date" : "20190905"&lt;/P&gt;&lt;P&gt;  }, {&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;    "color" : "blue",&lt;/P&gt;&lt;P&gt;    "date" : "20190905"&lt;/P&gt;&lt;P&gt;  }]&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2019 00:13:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-Jolt-Transform-JSON-Processor-Create-a-JSON-array-by/m-p/240180#M201986</guid>
      <dc:creator>pradeepraovenna</dc:creator>
      <dc:date>2019-05-11T00:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi - Jolt Transform JSON Processor - Create a JSON array by utilizing few fields of exiting JSON and ignore the null attributes while constructing the array</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-Jolt-Transform-JSON-Processor-Create-a-JSON-array-by/m-p/240181#M201987</link>
      <description>&lt;P&gt;To address your comment below, I missed the part where you want to call the outgoing field "color". Change this line (8):&lt;/P&gt;&lt;PRE&gt;"$": "colorsLove[].&amp;amp;2"&lt;/PRE&gt;&lt;P&gt;To this:&lt;/P&gt;&lt;PRE&gt;"$": "colorsLove[].color"&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2019 01:18:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-Jolt-Transform-JSON-Processor-Create-a-JSON-array-by/m-p/240181#M201987</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2019-05-11T01:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi - Jolt Transform JSON Processor - Create a JSON array by utilizing few fields of exiting JSON and ignore the null attributes while constructing the array</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-Jolt-Transform-JSON-Processor-Create-a-JSON-array-by/m-p/240182#M201988</link>
      <description>&lt;P&gt;Thank you so much Matt, this worked pretty well for me&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 23:36:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-Jolt-Transform-JSON-Processor-Create-a-JSON-array-by/m-p/240182#M201988</guid>
      <dc:creator>pradeepraovenna</dc:creator>
      <dc:date>2019-05-15T23:36:05Z</dc:date>
    </item>
  </channel>
</rss>

