Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

flatten json using nifi

avatar
Contributor

Hello All,

I want to flatten json records using nifi. The records are store in kafka as AVRO. I use the ConsumeKafkaRecord processor to convert avro to json. For flattening I would like to use the JoltTransformJSON processor, but this doesn't work since it expect as input a single json and not an array of json records.

Any ideas, how I can do this ?

Ideally is that I don't have to convert the records to json, but it seems that currently there is no processor to flatten avro.

Regards,

Chris

3 REPLIES 3

avatar
Master Guru
@chris herssens

After convert Avro to json processor use SplitJson processor with below configurations in it, if your data is having json Array then SplitJson processor split the array and every flowfile would be single record.

40809-splitjson.png

then use JoltTransform processor to flatten the json record.

Flow:-

ConsumeKafka--> convertAvroToJSON-->SplitJSON-->JoltTransform

avatar
Contributor

I have done this, but this gives performance issues.

I found how to do this with the JoltTransform processor.

avatar

could you please share the nifi template for this. I am not able to achieve this.