NiFi - converting JSON array into Avro Map
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

