XML to JSON only shows 1 item

After the XML-to-JSON node and after the Edit Field node, n8n only shows 1 item so I can’t iterate over it. I need to filter these URLs based on the lastmod property and then iterate over them to execute other nodes. The Loop node also only sees 1 item (despite it containing an array).

I read some of the documentation (Very Quick Quickstart, Looping in n8n, etc) but can’t understand how to “extract” my array from within the “url” field.

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
  • n8n version: 1.17.1
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud Starter Plan
  • Operating system: Windows 11, Chrome latest version

Hey @tomtom,

the XML to Json node returns 1 item containing a list of urls. That is dependend on the xml which is transformed.

For that kind of cases there is a item lists-node with a split out items function.

In the image you see that i created an object with urls similar to yours. And After the split the output is 10 items.
For Fields to split out you need to put something like urlset.url depending on your input for the split out node.

Afterwards you don’t need to create a loop with the loop node. N8n handles looping for you if you have more then one item as input for a node. The loop node is for edge cases like handling rate limiting in apis.

This is the whole example workflow:

Cheers.

2 Likes

That was a great explanation nico. It works! Thanks! :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.