Support Questions

Find answers, ask questions, and share your expertise

Avro object when converted to JSON is giving array instead of object

avatar
New Contributor

I am trying to create a flow to convert a JSON object to Avro and then consume the produced data from Avro to JSON.

nisha2112goyal_0-1716954563874.png

This is the sample data I am using 

nisha2112goyal_1-1716954702143.png

When I check the data that is finally consumed and converted back to JSON , It is coming as array instead of object :

[ {
"Vehicle" : "BigVehicle",
"Fromuser" : "User1",
"Timestamp" : "2024-03-19T13:00:00+0530"
} ]

convertRecord configuration for JSON toAvro conversion:

nisha2112goyal_2-1716954835993.pngnisha2112goyal_3-1716954868220.png

Convert Record from Avro to JSON:

nisha2112goyal_4-1716954910577.pngnisha2112goyal_5-1716954971171.pngnisha2112goyal_6-1716955039455.png

 

2 REPLIES 2

avatar
Community Manager

@nisha2112goyal, Welcome to our community! To help you get the best possible answer, I have tagged in our NiFi experts @SAMSAL @MattWho @steven-matison  who may be able to assist you further.

Please feel free to provide any additional information or details about your query, and we hope that you will find a satisfactory solution to your question.



Regards,

Vidya Sargur,
Community Manager


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:

avatar
Super Guru

Hi @nisha2112goyal ,

I will try and change the Output Grouping in the JsonREcordSertWRtiter  from Array to One Line Per Object and see if that helps.