Support Questions
Find answers, ask questions, and share your expertise

NiFi - Converting json with dynamic fields to csv

New Contributor

I am reading data from an API - its a complex json with multiple nested fields and array of structs. The number of fields within the array is dynamic. How can i flatten this json into csv using Nifi? 

 

I tried multiple options like Evaluatejsonpath - splitjson-replacetext/ evaluatejson-splitjson-convertrecord/evaluatejson-splitrecord-replacetext. 

 

The avro schema for the json is different for each record, so how i can use Inferavroschema and then convert the record into a csv accordingly? Not very familiar with the jolt transform options

 

Appreciate any inputs/pointers. @mburgess please guide.. 

 

Thanks in advance 

1 REPLY 1

Super Collaborator

First question: How would you do this outside Nifi?

 

I'm not sure if think the transformation from a Json with variable fields to a CSV is formally defined on a conceptual level. So finding a solution may not be trivial.

 

If you happen to find a script in python or so that has a decent implentation, then possibly the recommended course of action would be to let Nifi use that script.


- Dennis Jaheruddin

If this answer helped, please mark it as 'solved' and/or if it is valuable for future readers please apply 'kudos'.
Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.