Forum Discussion

kpatnala's avatar
kpatnala
New Contributor
7 years ago

XML Generator snap without XSD

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

  • cstewart's avatar
    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.

    • kpatnala's avatar
      kpatnala
      New Contributor

      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's avatar
        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.