Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 06-08-2022 07:51 AM
Hello,
On our use case, we're receiving data in JSON format and it must be converted into Avro using a schema that has X and Y includes mandatory fields and everything else (Z and W) should go into a Custom map.
Here is our Avro schema:
"fields": [
{"name": "X", "type": "long"},
{"name": "Y", "type": "string"},
{"name": "Custom", "type": { "type": "map", "values": "string" } }
]
And an example of data coming in:
{
"X":123,
"Y":"ABC",
"Z":"zzz",
"W":"www"
}
We have implemented a JoltTransform to do the needed transformation to get Z and W into a Custom array.
Now the issue is on doing the conversion from JSON into Avro since we get an error stating it cannot convert an java.lang.Object into a Map.
How can we properly process this JSON and put that array into a Map so it can be properly stored using that Avro schema?
Thank you.
Best regards,
Miguel
Created 06-08-2022 08:08 PM
@migu ,
What's your NiFi version and what's your JOLT transformation?
This should work, provided that your JOLTed JSON is correct.
Please see the attached flow, which works fine for me.
Cheers,
André
Created 06-08-2022 08:08 PM
@migu ,
What's your NiFi version and what's your JOLT transformation?
This should work, provided that your JOLTed JSON is correct.
Please see the attached flow, which works fine for me.
Cheers,
André
Created 06-13-2022 08:52 AM
@migu Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. If you are still experiencing the issue, can you provide the information @araujo has requested? Thanks
Regards,
Diana Torres,