cancel
Showing results for 
Search instead for 
Did you mean: 

XML Generator snap without XSD

kpatnala
New Contributor

Hi,

I want to convert JSON to XML and i’m using XML Generator with valid XSD.
I got the output XML after running the pipeline for a fixed known JSON format with fixed XSD.

If the JSON data is dynamic, Now I don’t know the JSON data format because it is a third party data getting from some REST GET snap request. I cannot define exact XSD in XML Generator snap.

Is there a way where the XML Generator generates XML from the dynamic JSON without depending on XSD?

Thanks,
Kiran

4 REPLIES 4

cstewart
Former Employee

If what you are trying to do is generate XML output from JSON Input, you can just use the XML Formatter, rather than the XML Generator.

Thank you. As you suggested I replaced the snap XML Generator with XML Formatter in the pipeline as shown below, but I’m not getting any XML output at XMLFormatter except some meta data like content-type etc… but I see JSON data at JSONParser.

REST GET → JSON Formatter → JSON Parser → XML Formatter

robin
Former Employee

If you don’t need a wrapping root element (which also includes a metadata element), leave the “Root element” property value empty and if your input JSON is compatible, the appropriate XML will be generated.

kpatnala
New Contributor

Thanks @cstewart @robin
I’m able to do it.
I have tried XMLFormatter before using Generator but I have not seen the preview of the XMLFormatter. Now when I added FileWriter snap to store the xml file, I see the valid XML file.

Thank you,
Kiran