<?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/214180#M176095</link>
    <description>&lt;P&gt;It occurred to me that it might be better to just convert the entire flowfile contents to the stringify version rather than isolating the problematic blob first.    I attempted this by using the following in the ExecuteScript:&lt;/P&gt;&lt;PRE&gt;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");
 
var flowFile = session.get();
if(flowFile != null) {
  // Create a new StreamCallback, passing in a function to define the interface method
  flowFile = session.write(flowFile,
    new StreamCallback(function(inputStream, outputStream) {
        var text = IOUtils.toString(inputStream, StandardCharsets.UTF_8)
        outputStream.write(JSON.stringify(text).getBytes(StandardCharsets.UTF_8))
    }));
     session.transfer(flowFile, REL_SUCCESS);
}


&lt;/PRE&gt;&lt;P&gt;However, the resulting content has been modified where the existing json structure is now masked by the use of escape characters before double quotes for instance.    Is there an easy way to convert this object back into a json array?    Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Apr 2017 22:21:42 GMT</pubDate>
    <dc:creator>murphy_sean</dc:creator>
    <dc:date>2017-04-28T22:21:42Z</dc:date>
  </channel>
</rss>

