Support Questions

Find answers, ask questions, and share your expertise

Convert Json to Avro processor -- Failed to Parse Record Schema

avatar
Contributor

Hi Friends,

Needed a help here.

I have picked up one of the xmls lying in the trafficLocs_data_for_simulator.zip.

My objective is to convert XML to Avro format. The tutorials has shown us how to convert XML to JSON format by using AttributesToJSON processor.

I am facing issue while configuring ConvertJSONToAvro processor.

I have used the Record Schema as mentioned below -

{ "type": "record", "name" : "first", "namespace" : "xml", "fields" : [{"name" : "Direction_of_Travel", "type" : "string" }, { "name" : "Latitude", "type" : "float" }, { "name" : "Longitude", "type" : "float" }, { "name" : "Vehicle_ID", "type" : "integer" }, { "name" : "Vehicle_Speed"," type" : "integer" }] }

I am getting red alert symbol mentioning it as Failed to Parse Record Schema.

Any pointers will help.

Thanks,

Ankur K

1 ACCEPTED SOLUTION

avatar
Super Guru

@Ankur Kapoor

Also attaching the template of my workflow.hcc.xml

View solution in original post

11 REPLIES 11

avatar
Rising Star

Hey @rajat puchnanda

First I would recommend extracting the attributes from JSON using EvaluateJSONPath processor, then utilize AttributesToCSV processor to represent the FlowFile attributes as CSV format.

For seeing how to use evaluateJSONPath processor, check out this part of the tutorial series:

https://hortonworks.com/tutorial/analyze-transit-patterns-with-apache-nifi/section/5/

AttributesToCSV processor is similar to AttributesToJSON processor, the following tutorial shows how to use AttributesToJSON, apply the similar idea to using AttributesToCSV processor:

https://hortonworks.com/tutorial/analyze-transit-patterns-with-apache-nifi/section/6/

For info on AttributesToCSV processor:

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.7.0/org.apache...

avatar
@jmedel

Any thoughts?