<?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: convert json to csv in nifi in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377148#M243156</link>
    <description>&lt;P&gt;Can you take screenshot of the JoltTranformRecord and the reader\write services settings?&lt;/P&gt;</description>
    <pubDate>Mon, 02 Oct 2023 17:25:33 GMT</pubDate>
    <dc:creator>SAMSAL</dc:creator>
    <dc:date>2023-10-02T17:25:33Z</dc:date>
    <item>
      <title>convert json to csv in nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/338457#M232829</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to convert json to csv in nifi. My json is something like below&amp;nbsp;&lt;/P&gt;&lt;P&gt;{"tokens":["12343455577666","2134421241241","124142141411445","21425654768686"]}&lt;/P&gt;&lt;P&gt;and my csv should be like below&lt;/P&gt;&lt;P&gt;tokens&lt;/P&gt;&lt;P&gt;12343455577666&lt;/P&gt;&lt;P&gt;2134421241241&lt;/P&gt;&lt;P&gt;124142141411445&lt;/P&gt;&lt;P&gt;21425654768686&lt;/P&gt;&lt;P&gt;Please help me. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 11:16:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/338457#M232829</guid>
      <dc:creator>VikasNayak07</dc:creator>
      <dc:date>2022-03-11T11:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: convert json to csv in nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/338465#M232832</link>
      <description>&lt;P&gt;There are a few posts on this topic.&amp;nbsp; The nearest to your need with a solution is&lt;BR /&gt;&lt;A href="https://community.cloudera.com/t5/Support-Questions/NiFi-JSON-Array-split/m-p/158842#M121233" target="_blank"&gt;https://community.cloudera.com/t5/Support-Questions/NiFi-JSON-Array-split/m-p/158842#M121233&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The key being using the SplitJson processor the updated doc reference is&amp;nbsp;&lt;BR /&gt;&lt;A href="https://nifi.apache.org/docs/nifi-docs/components/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.9.0/org.apache.nifi.processors.standard.SplitJson/index.html" target="_blank"&gt;https://nifi.apache.org/docs/nifi-docs/components/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.9.0/org.apache.nifi.processors.standard.SplitJson/index.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This will need to be used in combination with Reader &amp;gt; JsonPathReader &amp;gt; SplitJson &amp;gt; Writer&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 11:58:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/338465#M232832</guid>
      <dc:creator>Royles</dc:creator>
      <dc:date>2022-03-11T11:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: convert json to csv in nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/338619#M232878</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/96473"&gt;@VikasNayak07&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An easy way to achieve this is to use a JoltTransformRecord processor with a JsonTreeReader and a CSVRecordSetWriter. The following "Chain" transformation will produce the output that you want:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    "operation": "shift",
    "spec": {
      "tokens": {
        "*": "[&amp;amp;].token"
      }
    }
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;André&lt;/P&gt;&lt;P&gt;&lt;EM&gt;--&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Was your question answered? Please take some time to click on "&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;" below this post.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;If you find a reply useful, say thanks by clicking on the thumbs up button.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 02:38:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/338619#M232878</guid>
      <dc:creator>araujo</dc:creator>
      <dc:date>2022-03-15T02:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: convert json to csv in nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377141#M243150</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/11191"&gt;@araujo&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;I am trying to implement your suggested way.&lt;BR /&gt;My json is :&lt;BR /&gt;&lt;STRONG&gt;{&lt;BR /&gt;"Id" : "some int",&lt;BR /&gt;"TenantId" : "some double value"&lt;BR /&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;and I am using chain jolt transform method as:&lt;BR /&gt;&lt;STRONG&gt;[&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;"operation": "shift",&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;"spec": {&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;"*": {&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;"@(1,Id)": "[&amp;amp;1].Id",&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;"@(1,TenantId)": "[&amp;amp;1].TenantId"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}]&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;However, I am getting a error as:&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kiranq_0-1696263616383.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38589i5DF39C35F75337F2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kiranq_0-1696263616383.png" alt="Kiranq_0-1696263616383.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can you tell where I am going wrong?&lt;BR /&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 16:19:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377141#M243150</guid>
      <dc:creator>Kiranq</dc:creator>
      <dc:date>2023-10-02T16:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: convert json to csv in nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377143#M243152</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/105315"&gt;@Kiranq&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;from the error message I can see that your input seems to be in avro format. Are you sure the flowfile has valid json format? If not you can use ConvertAvroToJson processor before using the jolt transformation to convert avro to json. Also from the json you provided not sure your jolt spec will work. If you provide your json input and the expected output more accurately maybe I can help you with defining the correct jolt spec.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 16:32:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377143#M243152</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-10-02T16:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: convert json to csv in nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377145#M243153</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;thank you for responding.&lt;BR /&gt;&lt;BR /&gt;I am infact using/converting the output from ExecuteSql from Arvo to Json using ConvertAvroToJson processor.&amp;nbsp;&lt;BR /&gt;Below is the output of the same processor:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kiranq_0-1696264800859.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38590i21D30DC3E9B7B86A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kiranq_0-1696264800859.png" alt="Kiranq_0-1696264800859.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I am also wondering if I am providing the json format, its throwing error for avro.&amp;nbsp;&lt;BR /&gt;Can you suggest something?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 16:40:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377145#M243153</guid>
      <dc:creator>Kiranq</dc:creator>
      <dc:date>2023-10-02T16:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: convert json to csv in nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377146#M243154</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/105315"&gt;@Kiranq&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I have to look into the JoltTranformationRecord to see what configuration you have there vs what is expected. However since you are having a json input can you use the JoltTransformationJson processor instead or are you trying to convert the output json into different format?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 17:03:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377146#M243154</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-10-02T17:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: convert json to csv in nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377147#M243155</link>
      <description>&lt;P&gt;Thats right. I intend to convert the json using JoltTransfomationRecord into csv format and then save the file in my local machine.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 17:12:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377147#M243155</guid>
      <dc:creator>Kiranq</dc:creator>
      <dc:date>2023-10-02T17:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: convert json to csv in nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377148#M243156</link>
      <description>&lt;P&gt;Can you take screenshot of the JoltTranformRecord and the reader\write services settings?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 17:25:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377148#M243156</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-10-02T17:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: convert json to csv in nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377154#M243157</link>
      <description>&lt;P&gt;Here&lt;BR /&gt;&lt;BR /&gt;JoltTransforRecord:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kiranq_0-1696283131467.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38591iA31876760F086CBA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kiranq_0-1696283131467.png" alt="Kiranq_0-1696283131467.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;JsonTreeReader:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kiranq_1-1696283171922.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38592i56ECA47B88002C50/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kiranq_1-1696283171922.png" alt="Kiranq_1-1696283171922.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;AvroReader:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kiranq_2-1696283212507.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/38593iB33A23C23CC5639A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kiranq_2-1696283212507.png" alt="Kiranq_2-1696283212507.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 21:46:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377154#M243157</guid>
      <dc:creator>Kiranq</dc:creator>
      <dc:date>2023-10-02T21:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: convert json to csv in nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377180#M243169</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/105315"&gt;@Kiranq&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;What I found is that the JoltTransformRecord expects only single record to work with hence the name. I noticed when I try to pass an array I was getting the error "...error transforming the first record", however if I pass just one json record it works. If you have an array of json\csv and you are looking to split and process each record individually then I would suggest that you split the records before the JoltTransformRecord. If you dont want to split the array then I recommend using JoltTranformJson first and then use Convert Record processor to convert to CSV.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 15:12:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/convert-json-to-csv-in-nifi/m-p/377180#M243169</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-10-03T15:12:29Z</dc:date>
    </item>
  </channel>
</rss>

