nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hellstroem Christian (AE/PJ-ASC)" <Christian.Hellstr...@de.bosch.com>
Subject Split header from CSV and use for JSON
Date Fri, 29 Jan 2016 13:43:13 GMT
Hi,

I'm just starting out with NiFi and I am ingesting a CSV file with headers. I would like to
strip the header from each file and then use the header (with column names) to map each row
to JSON, after which more processing is done. Right now I'm stuck on which processors to use
and how to do the settings.

The CSV files are pretty much as follows:

SOME GENERIC INFO
COL1,COL2,COL3
VAL11,VAL12,VAL13
VAL21,VAL22,VAL23
...

Basically I want to remove the first line with 'some generic info' that is different for each
file, and I want the columns from line 2 to become fields in JSON, so that I end up with

{
  "COL1": "VAL11",
 "COL2" : "VAL12",
 "COL3": "VAL13"
}

etc.

I currently have a GetFile processor for the CSV file and an AttributesToJSON afterwards with
default settings, so there is no manual mapping done anywhere. I checked out the CSV2JSON
template by Hortonworks but that's a very manual process and that would be extremely tedious
as I have files with roughly a hundred columns.

I'm really stuck and any pointers would be greatly appreciated.

Also a content preview feature would be really helpful...

Cheers,

Ian.

Mime
View raw message