<?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 NiFi - JOLT to get json array as comma separated string in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-JOLT-to-get-json-array-as-comma-separated-string/m-p/236634#M85130</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have below json as flowfile content - &lt;/P&gt;&lt;P&gt;{ &lt;/P&gt;&lt;P&gt;"organization_id": "life-360", &lt;/P&gt;&lt;P&gt;"message_type_id": "MSG01", &lt;/P&gt;&lt;P&gt;"consent_required": "1", &lt;/P&gt;&lt;P&gt;"country_list": [
"GB",
"IT",
"BG"
]&lt;/P&gt;&lt;P&gt;
}&lt;/P&gt;&lt;P&gt;I want below content as output - &lt;/P&gt;&lt;P&gt;GB, IT, BG&lt;/P&gt;&lt;P&gt;I am able to get &lt;/P&gt;&lt;P&gt;"country_list": [ "GB", "IT", "BG" ] in flow file using JOLT but not comma separated country list.&lt;/P&gt;&lt;P&gt;Could any one please help with best way?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mahendra&lt;/P&gt;</description>
    <pubDate>Thu, 22 Nov 2018 18:53:02 GMT</pubDate>
    <dc:creator>hegdemahendra</dc:creator>
    <dc:date>2018-11-22T18:53:02Z</dc:date>
    <item>
      <title>NiFi - JOLT to get json array as comma separated string</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-JOLT-to-get-json-array-as-comma-separated-string/m-p/236634#M85130</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have below json as flowfile content - &lt;/P&gt;&lt;P&gt;{ &lt;/P&gt;&lt;P&gt;"organization_id": "life-360", &lt;/P&gt;&lt;P&gt;"message_type_id": "MSG01", &lt;/P&gt;&lt;P&gt;"consent_required": "1", &lt;/P&gt;&lt;P&gt;"country_list": [
"GB",
"IT",
"BG"
]&lt;/P&gt;&lt;P&gt;
}&lt;/P&gt;&lt;P&gt;I want below content as output - &lt;/P&gt;&lt;P&gt;GB, IT, BG&lt;/P&gt;&lt;P&gt;I am able to get &lt;/P&gt;&lt;P&gt;"country_list": [ "GB", "IT", "BG" ] in flow file using JOLT but not comma separated country list.&lt;/P&gt;&lt;P&gt;Could any one please help with best way?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mahendra&lt;/P&gt;</description>
      <pubDate>Thu, 22 Nov 2018 18:53:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-JOLT-to-get-json-array-as-comma-separated-string/m-p/236634#M85130</guid>
      <dc:creator>hegdemahendra</dc:creator>
      <dc:date>2018-11-22T18:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi - JOLT to get json array as comma separated string</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-JOLT-to-get-json-array-as-comma-separated-string/m-p/236635#M85131</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/48523/hegdemahendra.html" nodeid="48523" target="_blank"&gt;@Mahendra Hegde&lt;/A&gt;&lt;P&gt;AFAIK we cannot extract only the value using &lt;STRONG&gt;Jolt transform&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;To achieve this extract the array from the json using `&lt;STRONG&gt;EvaluateJsonPath&lt;/STRONG&gt;` processor&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;EvaluateJsonPath Configs:&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="93371-screen-shot-2018-11-22-at-71800-pm.png" style="width: 1096px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14358iF9DAB6ADE960B168/image-size/medium?v=v2&amp;amp;px=400" role="button" title="93371-screen-shot-2018-11-22-at-71800-pm.png" alt="93371-screen-shot-2018-11-22-at-71800-pm.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now using ReplaceText processor replace &lt;STRONG&gt;",[,],space&lt;/STRONG&gt; from the extracted value using NiFi expression language.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;ReplaceText Configs:&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="93372-screen-shot-2018-11-22-at-72003-pm.png" style="width: 1332px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14359i6E4E8D174B0F2B28/image-size/medium?v=v2&amp;amp;px=400" role="button" title="93372-screen-shot-2018-11-22-at-72003-pm.png" alt="93372-screen-shot-2018-11-22-at-72003-pm.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Search Value
&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;(?s)(^.*$)&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;Replacement Value
&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;${country_list:replaceAll('(\[|\]|"|\s)','')}&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;Character Set
&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;UTF-8&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;Maximum Buffer Size
&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;1 MB&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;Replacement Strategy
&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;Always Replace&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;Evaluation Mode
&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;Entire text&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;Input:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;{
"organization_id": "life-360",
"message_type_id": "MSG01",
"consent_required": "1",
"country_list": [ "GB", "IT", "BG" ]
}&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;GB,IT,BG&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Flow:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;1.other processors
2.EvaluateJsonPath //extract the json array as attribute value
3.ReplaceText //replace the content of flowfile with extracted value
4..other processors&lt;/PRE&gt;</description>
      <pubDate>Sat, 17 Aug 2019 23:29:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-JOLT-to-get-json-array-as-comma-separated-string/m-p/236635#M85131</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-17T23:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi - JOLT to get json array as comma separated string</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-JOLT-to-get-json-array-as-comma-separated-string/m-p/236636#M85132</link>
      <description>&lt;P&gt;Thanks &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; !&lt;/P&gt;&lt;P&gt;It worked, I was using 'Return type' as auto instead of json in EvaluateJsonPath.&lt;/P&gt;&lt;P&gt;Thanks for the reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Nov 2018 13:54:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-JOLT-to-get-json-array-as-comma-separated-string/m-p/236636#M85132</guid>
      <dc:creator>hegdemahendra</dc:creator>
      <dc:date>2018-11-23T13:54:27Z</dc:date>
    </item>
  </channel>
</rss>

