I have a NiFi flow that among other things transforms XML into JSON. This is done to prep the data for inserting into MongoDB. I'm using the TransformXML processor and an XSL to do the transform. Is this the correct method? Ordinarily, I would say that XSLT is not the best way to transform XML to JSON but it wasn't able to find another way in NiFi.
If your XML has a specific structure(not dynamic), you can use ConvertRecord processor.
XMLReader for read XML. For this, you must define an avro schema.JsonRecordSetWriter for write converted result. In this state, if you don't want to change structure, you don't have to change anything on JsonRecordSetWriter.For more information, I suggest you look at the link below.
https://pierrevillard.com/2018/06/28/nifi-1-7-xml-reader-writer-and-forkrecord-processor/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With