<?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 - Split a record using a non-root JSON attribute in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/NiFi-Split-a-record-using-a-non-root-JSON-attribute/m-p/237201#M199014</link>
    <description>&lt;P&gt;If I am reading your use case correctly, I think you're looking for what the &lt;A rel="noopener noreferrer noopener noreferrer" href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.9.2/org.apache.nifi.processors.standard.ForkRecord/index.html" target="_blank"&gt;ForkRecord&lt;/A&gt; processor does; it allows you to fork a (usually single) record into multiple records based on a Record Path (similar to JSONPath but different syntax and expressiveness), possibly keeping the "root" elements common to each outgoing record.&lt;/P&gt;</description>
    <pubDate>Sat, 10 Aug 2019 00:46:30 GMT</pubDate>
    <dc:creator>mburgess</dc:creator>
    <dc:date>2019-08-10T00:46:30Z</dc:date>
    <item>
      <title>NiFi - Split a record using a non-root JSON attribute</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-Split-a-record-using-a-non-root-JSON-attribute/m-p/237200#M199013</link>
      <description>&lt;P&gt;I have JSON input of the following format:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;{
&amp;nbsp; "Id": 1000000,
&amp;nbsp; "ReportName": TestReport,
&amp;nbsp; "Results": [{
&amp;nbsp; &amp;nbsp; "Id": 1,
&amp;nbsp; &amp;nbsp; "ResultId": "1000000-0",
&amp;nbsp; &amp;nbsp; "Query": {
&amp;nbsp; &amp;nbsp; &amp;nbsp; "Id": 001,
&amp;nbsp; &amp;nbsp; &amp;nbsp; "Name": "TestQuery0",
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; }, {
&amp;nbsp; &amp;nbsp; "Id": 2,
&amp;nbsp; &amp;nbsp; "ResultId": "1000000-1",
&amp;nbsp; &amp;nbsp; "Query": {
&amp;nbsp; &amp;nbsp; &amp;nbsp; "Id": 002,
&amp;nbsp; &amp;nbsp; &amp;nbsp; "Name": "TestQuery1",
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; }]
}&lt;/PRE&gt;&lt;P&gt;These file can become quite large depending on the number of Results in the Report and I was hoping to convert the single Flowfile to multiple records for processing. However, due to the format of the JSON a SplitRecord will result in one record per split. There is one report per FlowFile and therefore only 1 root level element.&lt;BR /&gt;&lt;STRONG&gt;I am looking for a method or strategy to split the Flowfile into smaller Records while still maintaining the cohesiveness of the report in the end when it put in HDFS.&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;Current Strategy:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Use JoltTransformJSON to inject report information into each result&lt;/LI&gt;&lt;LI&gt;Use SplitRecord to split the Flowfile on each result&lt;/LI&gt;&lt;LI&gt;Process Records&lt;/LI&gt;&lt;LI&gt;Use MergeRecord to get the modified Flowfile in Step1&lt;/LI&gt;&lt;LI&gt;Convert to original Flowfile (&lt;STRONG&gt;Not sure of the best method here&lt;/STRONG&gt;)&lt;/LI&gt;&lt;LI&gt;Use MergeContent and push to HDFS&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Any advice would be appreciated! Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 02:52:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-Split-a-record-using-a-non-root-JSON-attribute/m-p/237200#M199013</guid>
      <dc:creator>brotmanz</dc:creator>
      <dc:date>2019-08-07T02:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi - Split a record using a non-root JSON attribute</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-Split-a-record-using-a-non-root-JSON-attribute/m-p/237201#M199014</link>
      <description>&lt;P&gt;If I am reading your use case correctly, I think you're looking for what the &lt;A rel="noopener noreferrer noopener noreferrer" href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.9.2/org.apache.nifi.processors.standard.ForkRecord/index.html" target="_blank"&gt;ForkRecord&lt;/A&gt; processor does; it allows you to fork a (usually single) record into multiple records based on a Record Path (similar to JSONPath but different syntax and expressiveness), possibly keeping the "root" elements common to each outgoing record.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Aug 2019 00:46:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-Split-a-record-using-a-non-root-JSON-attribute/m-p/237201#M199014</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2019-08-10T00:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi - Split a record using a non-root JSON attribute</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-Split-a-record-using-a-non-root-JSON-attribute/m-p/279710#M208407</link>
      <description>&lt;P&gt;Thank you for the response. This was the correct answer, but I was unable to verify until recently.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 20:36:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-Split-a-record-using-a-non-root-JSON-attribute/m-p/279710#M208407</guid>
      <dc:creator>brotmanz</dc:creator>
      <dc:date>2019-10-08T20:36:38Z</dc:date>
    </item>
  </channel>
</rss>

