How to loop over multiple items return from single HTTP request?

I have a flow that does an http GET request to site.com/products, then uses an Extract HTML to tweeze out the a.product.title from that page. It finds multiple, and when I select “Return Array” it appears to give me an array of URLs to the individual products (as it should).

However, when I handle that into the next Widget, it only gets the first product…

As I understand it, n8n should automatically loop over all of the inputs, should it not?

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:

hello @oguruma

Please, share the workflow in order to be on the same page. If the array of the products is not on the root level, it won’t be process as array by n8n, it will be process as a single item. Plus, it matters how you are accessing the value from the previous node. It should have a relative reference, like {{ $json.product }}

I know enough javascript that I’m sure I can figure out how to build an array, that’s not really the problem. The problem I’m having is figuring out how to actually loop over said array. For instance, I have this workflow here that gives me an array of the objects with the url and slug of articles from a specific page on a local news site.

The “Loop Over” node seems like the most obvious way to do this, since the Loop Over Node doesn’t have an actual output, how do you tell the rest of the nodes what to use as input?

Here is an example of how to do it with and without the Code node

I have this workflow here, which loops through all the links and extracts the HTML, then passes that into OpenAI to summarize and create a title. The problem is that it’s basically looping over the article from the top of the list N times instead of iterating over all of the articles…

Remove the last Edit Fields node and it should works fine.