How to convert CSV data into JSON in Apache NiFi

preview_player
Показать описание
How to convert CSV data into JSON in Apache NiFi

Csv to Json

1 - GenerateFlowFile

first_name,age
adrian,12
aodba,10

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"}
]
}

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
Рекомендации по теме
Комментарии
Автор

Thank you so very much sir, With this detail i was able to achieve the objective.

bonnydavis
Автор

Nicely explained Thank you!!! I am cleared with my doubts on this topic!

akbarshaik
Автор

can you do the whole thing over but slower and explaining why you're doing what you're doing?

dufbal
Автор

can we use get file 'cause i want to convert an already existing csv file in my pc to json file ? or we have to use generate flowfile

saidanimalak-fgms
Автор

If the first line of my file is not 'schema' and the file is just content, how do I set it
Eg:
blablabla
Converted to
{" test ": "blablabla}"

刘阳-yw
Автор

hi.. do you know how to take 1 column in csv file, then create a new csv file that contain that column only. thanks

alprond
Автор

Hi. Can you let me know how we can take backup of dataflow .when the nifi is restarted all data flow are lost. Is there a way to backup nd restore dataflow when the nifi server goes for restart

sunilzwengineer
Автор

i want to send my data text data to mongodb. how to parse text data into json so that i can store it in db?

s.saranraj
Автор

Hi brother can you please tell me how can I take data from mysql and put it into another database of mysql ? I want to clone the database ...

chitrangsharma
Автор

how to use getfile processor instead of Generateflowfile??

theraven
Автор

Its really Helpful can please explain how to extract the data from one oracle table and insert into another oracle table using Nifi

VishwanathkKb
Автор

It would really helpful if would you provide next to this inserting those records to a database (oracle) table

akbarshaik
Автор

Do you have anything about json to csv????

juanpabloyela
Автор

How to insert data from rabbitmq to myql?

ThuyLe-prfi
visit shbcf.ru