Skip to main content
Prajeesh10
Bronze ⭐️⭐️⭐️
May 27, 2021 6:27 PM UTC
Solved

Split CSV between Multiple Records in Apache NIFI

I am trying to process a CSV file and convert it to a JSON in a specific format. My CSV file is as follows

START

PI,0010002,25,king,address,phone

PE,3.2,company1

PE,1.9,company2

STOP

START

PI,0010003,25,prince,address,phone

PE,3.2,company1

PE,1.9,company2

STOP

I want help in extracting records from START till STOP. I was able to do the JSON conversion.

MattWho
MattWhoAnswer
Titanium ⭐️⭐️
May 28, 2021 4:14 PM UTC

@Prajeesh10 

 

If you are trying to split your source CSV in to two different FlowFile before converting each to a JSON, you could use the "SplitContent" [1] processor.

MattWho_0-1622218384861.png

 

[1] https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.13.2/org.apache.nifi.processors.standard.SplitContent/index.html

 

If you found this useful, please take a moment to login and click "Accept" on this solution.
Thank you,

Matt

 



3 replies

MattWho
Titanium ⭐️⭐️
MattWhoAnswer
Titanium ⭐️⭐️
May 28, 2021 4:14 PM UTC

@Prajeesh10 

 

If you are trying to split your source CSV in to two different FlowFile before converting each to a JSON, you could use the "SplitContent" [1] processor.

MattWho_0-1622218384861.png

 

[1] https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.13.2/org.apache.nifi.processors.standard.SplitContent/index.html

 

If you found this useful, please take a moment to login and click "Accept" on this solution.
Thank you,

Matt

 



Translate
cjervis
Community Manager
Community Manager
Jun 3, 2021 12:32 PM UTC

@Prajeesh10  Has your issue been resolved? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. 

 

Screen Shot 2019-08-06 at 1.54.47 PM.pngmark as solution button

Translate
Keep the questions coming
prakashrulez
Silver ⭐️
Nov 28, 2022 1:56 PM UTC

id, name, balance, join_date, notes
1, John, 48.23, 04/03/2007 "Our very
first customer!"
2, Jane, 1245.89, 08/22/2009,
3, Frank Franklin, "48481.29", 04/04/2016,

the logic may fail in the above case, if column contains multiple rows.

Translate