n8n LabAdvanced
Collect Values from All Input Items in an n8n Code Node
Several leads arrive as separate items. Build one array of emails to send in a single API call.
Live Execution Simulator
Idle
π₯
Incoming Data
βοΈ
n8n Node
π―
Next Step
> Ready. Type your expression below and click "Check Answer" to run the node.
Incoming Payload / Data:
// Incoming items (each has .json):
[
{ "json": { "email": "[email protected]" } },
{ "json": { "email": "[email protected]" } }
]
$input.all().
βοΈ Your expression is executed against test data β any correct solution passes. +30 XP
β Solution & explanation
$input.all().map(item => item.json.email)
Output: ["[email protected]", "[email protected]"]
$input.all() returns every item that reached the node. Each item stores its data under .json, so the mapper reads item.json.email.π‘ Pro tip: In Run Once for Each Item mode use $input.item.json instead.
Also accepted: map(i => i.json.email)