<?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 AttributesToJSON makes everything strings in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Nifi-AttributesToJSON-makes-everything-strings/m-p/285357#M211773</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/71482"&gt;@craignelson7007&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you are starting with JSON content which you are extracting bits of into FlowFileAttributes just to write them back to json, have you considered skipping this completely and just using the NiFi JoltTransformJson processor to modify the existing json content instead?&lt;BR /&gt;&lt;BR /&gt;Here is a article with more details on using the JoltTransformJson processor:&lt;BR /&gt;&lt;A href="https://community.cloudera.com/t5/Community-Articles/Jolt-quick-reference-for-Nifi-Jolt-Processors/ta-p/244350" target="_blank"&gt;https://community.cloudera.com/t5/Community-Articles/Jolt-quick-reference-for-Nifi-Jolt-Processors/ta-p/244350&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Otherwise:&lt;/P&gt;&lt;P&gt;NiFi stores all FlowFile attributes as strings.&lt;BR /&gt;The json you have written out in a FlowFile Attribute is going to be stored as a string in the attribute key&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;vckey_list = ["test value"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The AttributesToJson processor builds a flat json from those attribute strings, so it is going to wrap the entire json in quotes and escape the embedded quotes within that string with a backslash.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could use a couple replaceText processors after your AttributesToJson processor to remove the unwanted quotes and backslashes from the newly created content.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is another reference around this processor limitation:&lt;BR /&gt;&lt;A href="http://apache-nifi.1125220.n5.nabble.com/Nesting-and-AttributesToJSON-td3575.html" target="_blank"&gt;http://apache-nifi.1125220.n5.nabble.com/Nesting-and-AttributesToJSON-td3575.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
    <pubDate>Wed, 11 Dec 2019 18:13:54 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2019-12-11T18:13:54Z</dc:date>
  </channel>
</rss>

