Struggling to convert XML to JSON

Testing out a workflow to convert XML to JSON

HTTP POST from insomnia to Webhook (n8n) with a body of XML (header Content-Type: text/xml)

Not sure how to share the workflow here as it will expose my ip addresses

Errors: Can’t convert to JSON with XML to JSON node
ERROR: No json property “data” does not exists on item!

Really like to be able to utilise this wonderful tools. I dont even mind going or the cloud tier but i keep struggling to get simple workflow to work.

Any help greatly appreciated!

Sorry to hear that you have problems. Sadly am I not able to help unless I understand how the data looks like that you receive. So please pin-the data on the node (Data pinning - n8n Documentation), edit the data that you do not want to disclose (like for example your IP address), and then share that node here. Thanks!

Hi @jan
I am usually ok reading docs but I am having some trouble understanding fully n8n docs.
I read the doc on data pinning, not too sure if i done it right. Please see my attachment:
After i pin the data, not sure where you meant by editing the data. Anyway I just edit from the output and save before pasting it here. Not sure why i should pin the data though since I am editing on the output.

The following node on the workflow is XML to JSON node but it returns an error as of the first post.

When i used an online XML to JSON conversion tool, it is formatted as expected. Could be just my brief knowledge on XML.

Really want to learn to use this awesome tool well but I really struggling to understand the n8n way.

Getting better after i re-read the docs. All nodes will output json(n8n) unless specified otherwise. So the webhook with XML body actually output JSON. I can then use expression to extract the value I need to inject into whatever subsequent nodes.

However Is it possible to parse the XML to a proper JSON format to be push to another application? Is there a node that can output the same as some of the online XML to JSON converters?
E.g. When i paste the same XML into here:
it ouptput a JSON with a first key {“order” : {…} }

Thanks in advance!

Sadly looks like that for some strange reason the pinned data does not get exported when you export only one node (already logged that internally). So what you would have to do is to use the “Workflow Download” option, to make sure that this data does not get lost.

You are right, n8n does always just output JSON. So your XML data ends up somewhere in that JSON, just do not know exactly how and that is why I need the data pinned to see exactly the same thing you are seeing to come up with a solution.

I really like to know more about how to know this tool properly.

I have copy and paste the node in a new workflow. Pin and edit the data. Download the workflow as a json file.

Hopefully the data is intact this time.

Great, thanks a lot. That worked now fine and I can see the data.

From what I can see did n8n already convert the data automatically from XML to JSON. You can see the data underneath the “body” property. So what else is to be done?

Yes you are right. I can pin point to the body to extract the JSON object. I think I need to wrap my head around with that many nodes available in n8n. Was fixated that I have to use the XML to JSON node to achieve what I needed.

I was wondering about the cloud Power tier with regards to support listed as email support. Can i safely says that on cloud Power tier, I can get email support for knowledge gap questions?

Anyway great product. Love to see it going strong.

Hey @leonardchiu,

With the email support plan you can indeed drop in an email with any questions or issues, It is often quicker than asking here but some of our users find both useful.