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