<?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: Best approach to re merging flowfiles in NiFi in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Best-approach-to-re-merging-flowfiles-in-NiFi/m-p/214179#M176094</link>
    <description>&lt;P&gt;Thank you for the reply Bryan.  I'm stripping the data not needing to be converted prior to the ExecuteScript via two SplitContext processors that utilize hardcoded hexadecimal strings to isolate the string (called attributed 'default_payload') needing to be converted via the ExecuteStript:&lt;/P&gt;&lt;PRE&gt;var flowFile = session.get();
  if (flowFile !== null) {
    var StreamCallback = Java.type("org.apache.nifi.processor.io.StreamCallback");
    var IOUtils = Java.type("org.apache.commons.io.IOUtils");
    var StandardCharsets = Java.type("java.nio.charset.StandardCharsets");
    flowFile = session.write(flowFile, new StreamCallback(function(inputStream, outputStream) {
       var contentObj = flowFile.getAttribute("default_payload");
        outputStream.write(JSON.stringify(contentObj ).getBytes(StandardCharsets.UTF_8));
    }));
    session.transfer(flowFile, REL_SUCCESS);
}&lt;/PRE&gt;&lt;P&gt;If I understand what your saying then the ExecuteScript would need to handled both the splitting and conversion at the same processor as to not write over attributes which would keep it synchronized in the flow?      I had tried to use a parent UpdateAttribute to introduce a unique value to the flowfile(s) prior to the split/convertion and other JSON processing, but I am thinking this is to loose of a linkage for this type of processing.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Apr 2017 04:29:49 GMT</pubDate>
    <dc:creator>murphy_sean</dc:creator>
    <dc:date>2017-04-28T04:29:49Z</dc:date>
  </channel>
</rss>

