Having XML to JSON issue

Hello,

I am trying to convert an XML message to JSO and I am getting the following error:

“ERROR: Non-whitespace before first tag. Line: 0 Column: 1 Char: [”

I have tried: origString.replace(“[”, “”).

With no success.

Top of JSON conversion follows:

[
{
“headers”:
{
“host”:
“groves.app.n8n.cloud”,
“x-request-id”:
“e0ca09094b6c8a597c1e63507499fd7a”,
“x-real-ip”:
“18.235.49.224”,

Any help would be appreciated.

Thanks

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @wtw0872, welcome to the community!

I am sorry you are having trouble. I quickly tried out the XML node on n8n 1.4.1 using the below workflow, but didn’t have any problems here:

The data is converted as expected:

Based on your error message it seems like it might just be a case of removing leading whitespaces from your existing XML data. Perhaps you can share a workflow using which your problem can be reproduced? You can of course redact anything confidential, but it’d be important to keep the problematic data structure itself.