<?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: Filter JSON File content using EvaluateJsonPath in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Filter-JSON-File-content-using-EvaluateJsonPath/m-p/365784#M239389</link>
    <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;pointed out, queryrecord is the best and easiest method to use.&lt;BR /&gt;Here, i have created a sample flow for your use as pix attached.&lt;BR /&gt;I hope it helps.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cld-1.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/36937i2415F04EB2038E1F/image-size/large?v=v2&amp;amp;px=999" role="button" title="cld-1.png" alt="cld-1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Mar 2023 16:49:47 GMT</pubDate>
    <dc:creator>rafy</dc:creator>
    <dc:date>2023-03-09T16:49:47Z</dc:date>
    <item>
      <title>Filter JSON File content using EvaluateJsonPath</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Filter-JSON-File-content-using-EvaluateJsonPath/m-p/364727#M239219</link>
      <description>&lt;P&gt;So I'm working with a batch JSON file with the following value :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    "eventType": "UPDATE",
    "eventTime": "2021-12-14T12:34:56.789012Z",
    "country": "ES",
    "resourceType": "Party"
  },
  {
    "eventType": "UPDATE",
    "eventTime": "2021-12-14T12:34:56.789012Z",
    "country": "ES",
    "resourceType": "Party"
  },
  {
    "eventType": "UPDATE",
    "eventTime": "2021-12-14T12:34:56.789012Z",
    "country": "FR",
    "resourceType": "Party"
  },
  {
    "eventType": "UPDATE",
    "eventTime": "2021-12-14T12:34:56.789012Z",
    "country": "FR",
    "resourceType": "Party"
  }
]
So I'm working with a batch JSON file with the following value :

[
  {
    "eventType": "UPDATE",
    "eventTime": "2021-12-14T12:34:56.789012Z",
    "country": "ES",
    "resourceType": "Party"
  },
  {
    "eventType": "UPDATE",
    "eventTime": "2021-12-14T12:34:56.789012Z",
    "country": "ES",
    "resourceType": "Party"
  },
  {
    "eventType": "UPDATE",
    "eventTime": "2021-12-14T12:34:56.789012Z",
    "country": "FR",
    "resourceType": "Party"
  },
  {
    "eventType": "UPDATE",
    "eventTime": "2021-12-14T12:34:56.789012Z",
    "country": "FR",
    "resourceType": "Party"
  }
]&lt;/LI-CODE&gt;&lt;P&gt;I'm able to extract attributes from JSON by using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;EvaluateJsonPath&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;processor.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UpdateAttribute&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is the processor where i want to extract the attributes. Please find below snapshot of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;UpdateAttribute&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;processor when value of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;"country="ES"&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I want get json file like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    "eventType": "UPDATE",
    "eventTime": "2021-12-14T12:34:56.789012Z",
    "country": "ES",
    "resourceType": "Party"
  },
  {
    "eventType": "UPDATE",
    "eventTime": "2021-12-14T12:34:56.789012Z",
    "country": "ES",
    "resourceType": "Party"
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/36867i3333B810C3375CE9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/36865iF4CCF4166D9D2547/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2.png" alt="2.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/36866i9D2BBBA1849EB8BA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="3.png" alt="3.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 13:51:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Filter-JSON-File-content-using-EvaluateJsonPath/m-p/364727#M239219</guid>
      <dc:creator>spartakus</dc:creator>
      <dc:date>2023-02-27T13:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Filter JSON File content using EvaluateJsonPath</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Filter-JSON-File-content-using-EvaluateJsonPath/m-p/364742#M239222</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I dont think the EvaluateJsonPath and RouteOnAttribute will work properly since you have an array of json records in the the incoming flowfiles. You have to split the array using SplitJson processor and then use the EvaluateJsonPath-&amp;gt;RouteOnAttributes to get the expected result. However there is better and more efficient option than using the mentioned processors (Split-&amp;gt;Evaluate-&amp;gt;Route), you can use just QueryRecords to filter the array and isolate the needed records. You can see example on how to use QueryRecords here: &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.19.1/org.apache.nifi.processors.standard.QueryRecord/additionalDetails.html" target="_blank"&gt;https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.19.1/org.apache.nifi.processors.standard.QueryRecord/additionalDetails.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If that helps , please accept solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 14:29:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Filter-JSON-File-content-using-EvaluateJsonPath/m-p/364742#M239222</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-02-27T14:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Filter JSON File content using EvaluateJsonPath</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Filter-JSON-File-content-using-EvaluateJsonPath/m-p/365784#M239389</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;pointed out, queryrecord is the best and easiest method to use.&lt;BR /&gt;Here, i have created a sample flow for your use as pix attached.&lt;BR /&gt;I hope it helps.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cld-1.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/36937i2415F04EB2038E1F/image-size/large?v=v2&amp;amp;px=999" role="button" title="cld-1.png" alt="cld-1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 16:49:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Filter-JSON-File-content-using-EvaluateJsonPath/m-p/365784#M239389</guid>
      <dc:creator>rafy</dc:creator>
      <dc:date>2023-03-09T16:49:47Z</dc:date>
    </item>
  </channel>
</rss>

