Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Converting JSON to CSV in NIFI.

Converting JSON to CSV in NIFI.

Explorer

I want to convert Json coming from MongoDb to csv and I am using ConvertRecord processor for this purpose. I have configured all the required controllers and I am using AvroSchemaRegistry controller to validate the json and .JsonTreereader controller to read the json but when I run the job it it throws the error that schema not found.

I have two question

  • Which is the most proper way to do this Job. i.e Converting JSON to CSV ?
  • How to pass schema into the JsonTreeReader

    This is ConvertRecord Processor Setting

    This my json file demo
{"id":1001,
"name":"vivek"}

nifi.png
3 REPLIES 3
Highlighted

Re: Converting JSON to CSV in NIFI.

Expert Contributor

@Vivek Singh

You can use evaluate json processor to evaluate the json fields and the use replace text processor to change it to csv

Highlighted

Re: Converting JSON to CSV in NIFI.

Can you show your configuration for the different controllers and readers/writters?

Highlighted

Re: Converting JSON to CSV in NIFI.

@Vivek Singh

Follow this link on the community to learn about the complete flow of how you can convert JSON to CSV.

This talks about Evaluating the JSON and then using the columns from the JSON file to be further used with a combination of processors to convert it into CSV.

Hope that helps!

Don't have an account?
Coming from Hortonworks? Activate your account here