Reputation: 3496
I need to convert the csv data into json value.
My CSV Data like below.
aa cc dd ee ff
cc dd ff gg hh ll mm nn oo pp
H1 "null" H3 "null" H5 H6 H7
c1 c2 c3
c4 c5 c6 c7 c8 c9 c10 c11 c12
i need to get the "H1" row data only it may contain some null columns which is in csv file.
How can i extract values in particular row values and convert that only into json value?
I have use split text and extract text,ReplaceText processor but it doesn't get "H1" row due to some empty columns present in the previous rows.
And processor only convert the "aa" row into json value.After that it doesn't read below rows.
Please anyone help me to solve this?
Upvotes: 1
Views: 236
Reputation: 390
Using extract text processor add some regex expression to get particular rows from csv file.
Using replace text processor add some value to null columns. Added new property to extract text processor as "Columndata" and add this (.+),(.+),(.+),(.+) regex expression to columndata field,which splits the data by comma.
Finally form json data with replace text processor. Add these expression {"Column1":${Columndata.1},"Column2":${Columndata.2},"Column3":${Columndata.3}} in replacement value of replace text processor.
Upvotes: 5