<?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: How to extract the size of a JSON array into an attribute? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/NiFi-How-to-extract-the-size-of-a-JSON-array-into-an/m-p/354819#M236991</link>
    <description>&lt;P&gt;You can use &lt;STRONG&gt;EvaluateJsonPath.&lt;/STRONG&gt; You only have to add an extra attribute and name it as you want (e.g. count) and set as value "$.my.array.size.length()". Then select &lt;STRONG&gt;Destination&lt;/STRONG&gt; and change it to &lt;U&gt;flowfile-attribute.&lt;/U&gt; This processor will produce a flowfile which has your extra attribute&lt;/P&gt;</description>
    <pubDate>Thu, 13 Oct 2022 19:28:42 GMT</pubDate>
    <dc:creator>antonisr11</dc:creator>
    <dc:date>2022-10-13T19:28:42Z</dc:date>
    <item>
      <title>NiFi: How to extract the size of a JSON array into an attribute?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-How-to-extract-the-size-of-a-JSON-array-into-an/m-p/241414#M203217</link>
      <description>&lt;P&gt;In my flow file I have JSON content which contains an array. How can I extract the size of that array into an attribute (e.g. my.array.size = 5)?&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 21:14:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-How-to-extract-the-size-of-a-JSON-array-into-an/m-p/241414#M203217</guid>
      <dc:creator>patrick_hochste</dc:creator>
      <dc:date>2019-05-29T21:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi: How to extract the size of a JSON array into an attribute?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-How-to-extract-the-size-of-a-JSON-array-into-an/m-p/241415#M203218</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/114363/patrickhochstenbach.html" nodeid="114363"&gt;@Patrick Hochstenbach&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can use &lt;STRONG&gt;SplitJson&lt;/STRONG&gt; processor to &lt;STRONG&gt;split the array($.*)&lt;/STRONG&gt; into individual flowfile then &lt;STRONG&gt;split json&lt;/STRONG&gt; processor adds &lt;STRONG&gt;&lt;U&gt;&lt;EM&gt; fragment.count &lt;/EM&gt;&lt;/U&gt;&lt;/STRONG&gt;attribute to the flowfile which is array size.&lt;/P&gt;&lt;P&gt;Use &lt;STRONG&gt;UpdateAttribute&lt;/STRONG&gt; processor to change the attribute name.&lt;/P&gt;&lt;P&gt;Use &lt;STRONG&gt;MergeContent&lt;/STRONG&gt; processor to merge back the content using Defragment strategy.&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 08:59:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-How-to-extract-the-size-of-a-JSON-array-into-an/m-p/241415#M203218</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-05-30T08:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi: How to extract the size of a JSON array into an attribute?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-How-to-extract-the-size-of-a-JSON-array-into-an/m-p/241416#M203219</link>
      <description>&lt;P&gt;Thanks, I was hoping for an easy trick because I needed many of these calculations. Maybe I need to write a custom processor for this.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 14:07:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-How-to-extract-the-size-of-a-JSON-array-into-an/m-p/241416#M203219</guid>
      <dc:creator>patrick_hochste</dc:creator>
      <dc:date>2019-06-03T14:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi: How to extract the size of a JSON array into an attribute?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-How-to-extract-the-size-of-a-JSON-array-into-an/m-p/241417#M203220</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/114363/patrickhochstenbach.html" nodeid="114363"&gt;@Patrick Hochstenbach&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Yes,You can consider custom processor/custom script for this, to do this in easier way and add the attribute to the flowfile with array size.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 09:58:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-How-to-extract-the-size-of-a-JSON-array-into-an/m-p/241417#M203220</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-06-04T09:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi: How to extract the size of a JSON array into an attribute?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-How-to-extract-the-size-of-a-JSON-array-into-an/m-p/354819#M236991</link>
      <description>&lt;P&gt;You can use &lt;STRONG&gt;EvaluateJsonPath.&lt;/STRONG&gt; You only have to add an extra attribute and name it as you want (e.g. count) and set as value "$.my.array.size.length()". Then select &lt;STRONG&gt;Destination&lt;/STRONG&gt; and change it to &lt;U&gt;flowfile-attribute.&lt;/U&gt; This processor will produce a flowfile which has your extra attribute&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 19:28:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-How-to-extract-the-size-of-a-JSON-array-into-an/m-p/354819#M236991</guid>
      <dc:creator>antonisr11</dc:creator>
      <dc:date>2022-10-13T19:28:42Z</dc:date>
    </item>
  </channel>
</rss>

