<?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: want to convert csv to nested json using nifi in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/want-to-convert-csv-to-nested-json-using-nifi/m-p/376789#M82484</link>
    <description>&lt;P&gt;I'm new to nifi I'm working on it can you send me the flow file I am getting confused which processor need to use&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Sep 2023 12:43:10 GMT</pubDate>
    <dc:creator>Abhiram-4455</dc:creator>
    <dc:date>2023-09-25T12:43:10Z</dc:date>
    <item>
      <title>want to convert csv to nested json using nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/want-to-convert-csv-to-nested-json-using-nifi/m-p/224954#M82481</link>
      <description>&lt;P&gt;csv file:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;"Foo","12","newyork","North avenue","123213"
"Foo1","12","newyork","North avenue","123213"
"Foo2","12","newyork","North avenue","123213"&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;Output required:&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;{
    "studentName":"Foo",
    "Age":"12",
    "address__city":"newyork",
    "address":{
        "address__address1":"North avenue",
        "address__zipcode":"123213"
    }
}&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;I am able to convert csv to simple json but not nested json using convertRecord Processor.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;please check my Avro schema:&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;

{
  "type" : "record",
  "name" : "MyClass",
  "namespace" : "com.test.avro",
  "fields" : [ {
    "name" : "studentName",
    "type" : "string"
  }, {
    "name" : "Age",
    "type" : "string"
  }, {
    "name" : "address__city",
    "type" : "string"
  }, {
    "name" : "address",
    "type" : {
      "type" : "record",
      "name" : "address",
      "fields" : [ {
        "name" : "address__address1",
        "type" : "string"
      }, {
        "name" : "address__zipcode",
        "type" : "string"
      } ]
    }
  } ]
}	
	
&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Aug 2018 22:49:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/want-to-convert-csv-to-nested-json-using-nifi/m-p/224954#M82481</guid>
      <dc:creator>bhandari_surbhi</dc:creator>
      <dc:date>2018-08-21T22:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: want to convert csv to nested json using nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/want-to-convert-csv-to-nested-json-using-nifi/m-p/224955#M82482</link>
      <description>&lt;P&gt;ConvertRecord is mostly for changing data formats, not structure. UpdateRecord is more appropriate, but I don't believe this is currently possible, as the "address" field doesn't exist in the input, and we don't currently update the schema in that case. I've filed &lt;A href="https://issues.apache.org/jira/browse/NIFI-5524" target="_blank"&gt;NIFI-5524&lt;/A&gt; to cover this improvement.  You'll also be able to accomplish this with JoltTransformRecord when &lt;A href="https://issues.apache.org/jira/browse/NIFI-5353" target="_blank"&gt;NIFI-5353&lt;/A&gt; is implemented.&lt;/P&gt;&lt;P&gt;In the meantime you can use ConvertRecord to convert from flat CSV into flat JSON (the writer can inherit the record schema), then use &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.7.1/org.apache.nifi.processors.standard.JoltTransformJSON/index.html" target="_blank"&gt;JoltTransformJSON&lt;/A&gt; to push the fields into the "address" object, here's a spec that will do that:&lt;/P&gt;&lt;PRE&gt;[
  {
    "operation": "shift",
    "spec": {
      "*": {
        "address1": "[#2].address.address_address1",
        "zipcode": "[#2].address.address_zipcode",
        "*": "[#2].&amp;amp;"
      }
    }
  }
]&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Aug 2018 22:37:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/want-to-convert-csv-to-nested-json-using-nifi/m-p/224955#M82482</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2018-08-22T22:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: want to convert csv to nested json using nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/want-to-convert-csv-to-nested-json-using-nifi/m-p/224956#M82483</link>
      <description>&lt;P&gt;Hi &lt;A href="https://community.hortonworks.com/users/641/mburgess.html"&gt;Matt Burgess&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;It worked and now I am able to convert csv into nested JSON.&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 13:54:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/want-to-convert-csv-to-nested-json-using-nifi/m-p/224956#M82483</guid>
      <dc:creator>bhandari_surbhi</dc:creator>
      <dc:date>2018-08-23T13:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: want to convert csv to nested json using nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/want-to-convert-csv-to-nested-json-using-nifi/m-p/376789#M82484</link>
      <description>&lt;P&gt;I'm new to nifi I'm working on it can you send me the flow file I am getting confused which processor need to use&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 12:43:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/want-to-convert-csv-to-nested-json-using-nifi/m-p/376789#M82484</guid>
      <dc:creator>Abhiram-4455</dc:creator>
      <dc:date>2023-09-25T12:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: want to convert csv to nested json using nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/want-to-convert-csv-to-nested-json-using-nifi/m-p/376821#M82485</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/107095"&gt;@Abhiram-4455&lt;/a&gt;&amp;nbsp;As this is an older post, you would have a better chance of receiving a resolution by&lt;A href="“https://community.cloudera.com/t5/forums/postpage/board-id/Questions”" target="_blank"&gt; starting a new thread&lt;/A&gt;. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post. Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 21:42:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/want-to-convert-csv-to-nested-json-using-nifi/m-p/376821#M82485</guid>
      <dc:creator>DianaTorres</dc:creator>
      <dc:date>2023-09-25T21:42:16Z</dc:date>
    </item>
  </channel>
</rss>

