<?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 Data transformation in Nifi in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Data-transformation-in-Nifi/m-p/391184#M247516</link>
    <description>&lt;P&gt;Hi Team,&lt;BR /&gt;I want to achive the below mentioned transformation in Nifi. using any processor. Please help me to get this done.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;sample input:&lt;BR /&gt;{&lt;BR /&gt;"date": "35 days 11:13:10.88",&lt;BR /&gt;"key1": "value1",&lt;BR /&gt;"keyToBeMapped1": "hostname.com",&lt;BR /&gt;"key2": "value2",&lt;BR /&gt;"key3": "value3",&lt;BR /&gt;"key4": "value4",&lt;BR /&gt;"keyToBeMapped2": "High Paging Rate",&lt;BR /&gt;"key5": "PAGING",&lt;BR /&gt;"keyToBeMapped3": "A high paging activity has been detected on host abc.lab.com. This could mean that too many processes are being run",&lt;BR /&gt;"Entity OID": "keyToBeMapped1",&lt;BR /&gt;"Parameter": "keyToBeMapped2",&lt;BR /&gt;"Description": "keyToBeMapped3"&lt;BR /&gt;}&lt;BR /&gt;Expected Output:&lt;BR /&gt;{&lt;BR /&gt;"date": "35 days 11:13:10.88",&lt;BR /&gt;"key1": "value1",&lt;BR /&gt;"keyToBeMapped1": "hostname.com",&lt;BR /&gt;"key2": "value2",&lt;BR /&gt;"key3": "value3",&lt;BR /&gt;"key4": "value4",&lt;BR /&gt;"keyToBeMapped2": "High Paging Rate",&lt;BR /&gt;"key5": "PAGING",&lt;BR /&gt;"keyToBeMapped3": "A high paging activity has been detected on host abc.lab.com. This could mean that too many processes are being run",&lt;BR /&gt;"Entity OID": "hostname.com",&lt;BR /&gt;"Parameter": "High Paging Rate",&lt;BR /&gt;"Description": "A high paging activity has been detected on host abc.lab.com. This could mean that too many processes are being run"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Priyanka&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jul 2024 12:05:55 GMT</pubDate>
    <dc:creator>PriyankaMondal</dc:creator>
    <dc:date>2024-07-31T12:05:55Z</dc:date>
    <item>
      <title>Data transformation in Nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Data-transformation-in-Nifi/m-p/391184#M247516</link>
      <description>&lt;P&gt;Hi Team,&lt;BR /&gt;I want to achive the below mentioned transformation in Nifi. using any processor. Please help me to get this done.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;sample input:&lt;BR /&gt;{&lt;BR /&gt;"date": "35 days 11:13:10.88",&lt;BR /&gt;"key1": "value1",&lt;BR /&gt;"keyToBeMapped1": "hostname.com",&lt;BR /&gt;"key2": "value2",&lt;BR /&gt;"key3": "value3",&lt;BR /&gt;"key4": "value4",&lt;BR /&gt;"keyToBeMapped2": "High Paging Rate",&lt;BR /&gt;"key5": "PAGING",&lt;BR /&gt;"keyToBeMapped3": "A high paging activity has been detected on host abc.lab.com. This could mean that too many processes are being run",&lt;BR /&gt;"Entity OID": "keyToBeMapped1",&lt;BR /&gt;"Parameter": "keyToBeMapped2",&lt;BR /&gt;"Description": "keyToBeMapped3"&lt;BR /&gt;}&lt;BR /&gt;Expected Output:&lt;BR /&gt;{&lt;BR /&gt;"date": "35 days 11:13:10.88",&lt;BR /&gt;"key1": "value1",&lt;BR /&gt;"keyToBeMapped1": "hostname.com",&lt;BR /&gt;"key2": "value2",&lt;BR /&gt;"key3": "value3",&lt;BR /&gt;"key4": "value4",&lt;BR /&gt;"keyToBeMapped2": "High Paging Rate",&lt;BR /&gt;"key5": "PAGING",&lt;BR /&gt;"keyToBeMapped3": "A high paging activity has been detected on host abc.lab.com. This could mean that too many processes are being run",&lt;BR /&gt;"Entity OID": "hostname.com",&lt;BR /&gt;"Parameter": "High Paging Rate",&lt;BR /&gt;"Description": "A high paging activity has been detected on host abc.lab.com. This could mean that too many processes are being run"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Priyanka&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 12:05:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Data-transformation-in-Nifi/m-p/391184#M247516</guid>
      <dc:creator>PriyankaMondal</dc:creator>
      <dc:date>2024-07-31T12:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Data transformation in Nifi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Data-transformation-in-Nifi/m-p/391395#M247602</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/101202"&gt;@PriyankaMondal&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Hi Team,&lt;BR /&gt;I want to achive the below mentioned transformation in Nifi. using any processor. Please help me to get this done.&amp;nbsp;&lt;A href="https://www.my-loweslife.com" target="_blank" rel="noopener"&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#FFFFFF"&gt;my lowes life&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;sample input:&lt;BR /&gt;{&lt;BR /&gt;"date": "35 days 11:13:10.88",&lt;BR /&gt;"key1": "value1",&lt;BR /&gt;"keyToBeMapped1": "hostname.com",&lt;BR /&gt;"key2": "value2",&lt;BR /&gt;"key3": "value3",&lt;BR /&gt;"key4": "value4",&lt;BR /&gt;"keyToBeMapped2": "High Paging Rate",&lt;BR /&gt;"key5": "PAGING",&lt;BR /&gt;"keyToBeMapped3": "A high paging activity has been detected on host abc.lab.com. This could mean that too many processes are being run",&lt;BR /&gt;"Entity OID": "keyToBeMapped1",&lt;BR /&gt;"Parameter": "keyToBeMapped2",&lt;BR /&gt;"Description": "keyToBeMapped3"&lt;BR /&gt;}&lt;BR /&gt;Expected Output:&lt;BR /&gt;{&lt;BR /&gt;"date": "35 days 11:13:10.88",&lt;BR /&gt;"key1": "value1",&lt;BR /&gt;"keyToBeMapped1": "hostname.com",&lt;BR /&gt;"key2": "value2",&lt;BR /&gt;"key3": "value3",&lt;BR /&gt;"key4": "value4",&lt;BR /&gt;"keyToBeMapped2": "High Paging Rate",&lt;BR /&gt;"key5": "PAGING",&lt;BR /&gt;"keyToBeMapped3": "A high paging activity has been detected on host abc.lab.com. This could mean that too many processes are being run",&lt;BR /&gt;"Entity OID": "hostname.com",&lt;BR /&gt;"Parameter": "High Paging Rate",&lt;BR /&gt;"Description": "A high paging activity has been detected on host abc.lab.com. This could mean that too many processes are being run"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Priyanka&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;You can achieve this transformation in NiFi using the JoltTransformJSON processor. Jolt is a JSON-to-JSON transformation library that allows you to specify transformations in a declarative way. Here’s how you can set it up:&lt;/P&gt;&lt;P&gt;Steps to Configure JoltTransformJSON Processor&lt;BR /&gt;Add the JoltTransformJSON Processor:&lt;BR /&gt;Drag and drop the JoltTransformJSON processor onto your NiFi canvas.&lt;BR /&gt;Configure the Processor:&lt;BR /&gt;Double-click the processor to open its configuration dialog.&lt;BR /&gt;Go to the Properties tab.&lt;BR /&gt;Set the Jolt Specification:&lt;BR /&gt;In the Jolt Specification property, you will define the transformation rules. Here’s the Jolt spec you need for your transformation:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    "operation": "shift",
    "spec": {
      "date": "date",
      "key1": "key1",
      "keyToBeMapped1": "keyToBeMapped1",
      "key2": "key2",
      "key3": "key3",
      "key4": "key4",
      "keyToBeMapped2": "keyToBeMapped2",
      "key5": "key5",
      "keyToBeMapped3": "keyToBeMapped3",
      "Entity OID": "@(1,keyToBeMapped1)",
      "Parameter": "@(1,keyToBeMapped2)",
      "Description": "@(1,keyToBeMapped3)"
    }
  }
]&lt;/LI-CODE&gt;&lt;P&gt;Apply the Configuration:&lt;BR /&gt;Click Apply to save the configuration.&lt;BR /&gt;Connect the Processor:&lt;BR /&gt;Connect the JoltTransformJSON processor to the next processor in your flow.&lt;BR /&gt;Explanation of the Jolt Specification&lt;BR /&gt;The operation is set to shift, which means we are mapping fields from the input JSON to the output JSON.&lt;BR /&gt;The spec defines the mapping rules. For example, "Entity OID": "@(1,keyToBeMapped1)" means that the value of keyToBeMapped1 should be assigned to Entity OID in the output JSON.&lt;BR /&gt;Example Flow&lt;BR /&gt;GenerateFlowFile (to simulate input JSON)&lt;BR /&gt;JoltTransformJSON (with the above specification)&lt;BR /&gt;LogAttribute (to log the transformed JSON)&lt;BR /&gt;This setup should transform your input JSON to the expected output format.&lt;BR /&gt;&lt;BR /&gt;Hope this will help you.&lt;BR /&gt;Best regards,&lt;BR /&gt;florence023&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 11:35:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Data-transformation-in-Nifi/m-p/391395#M247602</guid>
      <dc:creator>florence0239</dc:creator>
      <dc:date>2024-08-06T11:35:09Z</dc:date>
    </item>
  </channel>
</rss>

