Turn array of objects sent via Webhook into items

Hey,

I’m quite new to n8n so please bear with me - this question is probably rather simple and basic but I feel like I’m having a hard time understanding these basics right now.

I’m sending in data via a webhook which works great at first. The body of the http request is an array of objects looking roughly like this:

[
{
"order date": "2023-12-21T00:00:00Z",
"order nr": "10720284",
"date": "2023-12-25T00:00:00Z",
"country": "DE",
"link": "https://www2..."
},
{
"order date": "2023-12-21T00:00:00Z",
"order nr": "10720284",
"date": "2023-12-25T00:00:00Z",
"country": "DE",
"link": "https://www2..."
},
{
"order date": "2023-12-21T00:00:00Z",
"order nr": "10720284",
"date": "2023-12-25T00:00:00Z",
"country": "DE",
"link": "https://www2..."
}
]

I have control over the data sent. Is there a way to send this data in one request so n8n recognizes each of the obects as items? If not how would I convert them into items?

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:

I’m not sure I understand exactly what you mean by items. If you’re using items the same way n8n is than you don’t need to do anything, because n8n nodes default it to run for each item in a list.

Currently, if that came in through a webhook, each object (The data in each {}) will be converted into an item.

[ ← starts list of items
{“key”: “value”,}, ← item/object in list
{“key”: “value”,}, ← item/object in list
{“key”: “value”,}, ← item/object in list
] ← ends list of items

For example:

i added in your example data in this workflow (which you can do with the pencil icon in the top left of the workflow node). This email will be sent 3 times, one for each item/object in your webhook.

Is this the behavior you are asking about?

Thanks for helping, @liam

I was indeed talking about items in the sense n8n is using them. As I understand for items recognized as such by n8n it does proceed in the workflow by running it once for every item. That is what I would want to do.

The structure you are showing looks exactly what I’m sending but still the webhook receiver on n8n only recognizes one item with the full array of objects in the body.

I’m sending via a python script using requests. I wonder what I’m doing wrong.

Here’s a screen of the test I sent and how it is received by webhooks. That hopefully illustrates my problem.

In the body part of the one single item n8n recognizes you can see the array count starting at 0 and each object underneath.

Maybe I’m just overlooking something important.