top of page

Converting Content to Attributes in Apache NiFi

Writer's picture: Stevanus MardiadyStevanus Mardiady
In Apache NiFi, flowfiles are the fundamental data structures that carry data through the system. While flowfiles have content, they also have attribute (metadata that describes the content). Sometimes, it’s useful to convert specific pieces of content into attributes for easier processing and routing. This article will guide you through this process.

Step-by-step process :

  1. Generate CSV Data

  2. Convert CSV to JSON

  3. Split Data

  4. Extract Content (JSON) to Attributes

 
Set Up The Flow in NiFi

NiFi Flow Explanation:

  1. Generate order details

    We begin by generating order details using the GenerateFlowFile processor, which creates flowfiles based on our sample data.

  2. Convert CSV to JSON

    The next step is converting the data in the flowfile from CSV format to JSON format.

  3. Split data

    We then split the JSON array into individual flowfiles, creating one flowfile for each entry.

  4. Extract content (JSON) to attributes

    Finally, we extract the customer_id and order_id values into attributes for each flowfile.

 
Sample Data

Input Data: Order Details

Convert Data: CSV to JSON

Output Data: 4 Flowfiles

 
Processor Properties
  • Generate order details

Processor Name: GenerateFlowFile
  • Convert CSV to JSON

Processor Name: ConvertRecord
  • Split Data

Processor Name: SplitJSON
  • Extract Content (JSON) to Attributes

Processor Name: EvaluateJsonPath
 
Step-by-Step Video Guide

Converting Content to Attributes in Apache NiFi


Recent Posts

See All

Comments


© 2024
PT. Expecomputindo. 

​"No animals were harmed in the making of this site"

bottom of page