How to convert CSV data into JSON in Apache NiFi
http://www.aodba.com
Csv to Json
1 - GenerateFlowFile
first_name,age
adrian,12
aodba,10
schema.name: personvalues
2 - Convert Record
Converts between formats and/or like schemas. For example, conversion from CSV to Json can be performed by configuring
ConvertRecord with a CsvReader and an JsonRecordSetWriter.
called "CSV2JSON AvroSchemaRegistry"
{
"name": "person",
"namespace": "nifi",
"type": "record",
"fields": [
{"name": "first_name" , "type" : "string"},
{"name": "age" , "type" : "int"}
]
}
https://json-schema-validator.herokuapp.com/avro.jsp
create CSVReader called "CSV2JSON CSVReader"
create JsonRecordSetWriter called "CSV2JSON JsonRecordSetWriter"
3 - logattribute
[ {
"first_name" : null,
"age" : 12
}, {
"first_name" : null,
"age" : 10
} ]
apache nifi | nifi hadoop | nifi processors | nifi | nifi examples | nifi etl | apache nifi example