<?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 How to extract json array using EvaluateJsonPath processor in NiFi? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-extract-json-array-using-EvaluateJsonPath-processor/m-p/312200#M225035</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have json flowfile,&amp;nbsp; [{"prediction":"Test2"},{"prediction":"Test2"}].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am want extract the 1st part of the array ie&amp;nbsp;prediction":"Test2&amp;nbsp; my destination is flowfile-attribute using&amp;nbsp;EvaluateJsonPath .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added a custom attribute mlresult ---&amp;gt;$.prediction[0], to extract the "Test2" into mlresult, but I am getting empty string&amp;nbsp; for the mlresults for the flow file attribute section.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;flow file :&amp;nbsp;[{"prediction":"Test2"},{"prediction":"Test2"}]&lt;/P&gt;&lt;P&gt;EvaluateJsonPath configuration:&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mlresult.PNG" style="width: 775px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30543i5220DDC48593714E/image-size/large?v=v2&amp;amp;px=999" role="button" title="mlresult.PNG" alt="mlresult.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to get the value(only one)&amp;nbsp; Test2 to mlresult?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;--Murali&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Mar 2021 03:16:01 GMT</pubDate>
    <dc:creator>murali2425</dc:creator>
    <dc:date>2021-03-01T03:16:01Z</dc:date>
    <item>
      <title>How to extract json array using EvaluateJsonPath processor in NiFi?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-extract-json-array-using-EvaluateJsonPath-processor/m-p/312200#M225035</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have json flowfile,&amp;nbsp; [{"prediction":"Test2"},{"prediction":"Test2"}].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am want extract the 1st part of the array ie&amp;nbsp;prediction":"Test2&amp;nbsp; my destination is flowfile-attribute using&amp;nbsp;EvaluateJsonPath .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added a custom attribute mlresult ---&amp;gt;$.prediction[0], to extract the "Test2" into mlresult, but I am getting empty string&amp;nbsp; for the mlresults for the flow file attribute section.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;flow file :&amp;nbsp;[{"prediction":"Test2"},{"prediction":"Test2"}]&lt;/P&gt;&lt;P&gt;EvaluateJsonPath configuration:&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mlresult.PNG" style="width: 775px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30543i5220DDC48593714E/image-size/large?v=v2&amp;amp;px=999" role="button" title="mlresult.PNG" alt="mlresult.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to get the value(only one)&amp;nbsp; Test2 to mlresult?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;--Murali&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 03:16:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-extract-json-array-using-EvaluateJsonPath-processor/m-p/312200#M225035</guid>
      <dc:creator>murali2425</dc:creator>
      <dc:date>2021-03-01T03:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract json array using EvaluateJsonPath processor in NiFi?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-extract-json-array-using-EvaluateJsonPath-processor/m-p/312209#M225036</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/72826"&gt;@murali2425&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are two possible solutions.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-03-01_HCC_json.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/30544iC879CC0A2A0D5D68/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-03-01_HCC_json.png" alt="2021-03-01_HCC_json.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;At solution 1 the value is set into an array.&lt;BR /&gt;&lt;BR /&gt;At solution 2 I took the flowfile-content (json) and set it into an attribute. Then you can work with expression language to get the value.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For testing the syntax I recommend this site:&lt;BR /&gt;&lt;A href="http://jsonpath.herokuapp.com/" target="_blank"&gt;http://jsonpath.herokuapp.com/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 06:23:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-extract-json-array-using-EvaluateJsonPath-processor/m-p/312209#M225036</guid>
      <dc:creator>justenji</dc:creator>
      <dc:date>2021-03-01T06:23:41Z</dc:date>
    </item>
  </channel>
</rss>

