Hi Support Team,
I’m encountering an issue while trying to pass the entire output of a node to another node in JSON format in an n8n workflow. Here are the details:
- Workflow Context:
I have a node namedcode to extract variants and create the json2
, which I believe outputs an array of objects.
However, when I use the following expression:
{{ JSON.stringify($node["code to extract variants and create the json2"].json) }}
It only includes the first item in the array, rather than the entire array of objects.
I expect the output to be something like this:
[
{
"title": "Apple 98-1",
"sku": "apple-ninety-eight-1",
"price": 19.99,
"qty": 999,
"variations": [
{ "variant": "Quantity", "option": "1", "key": "", "variantType": "D" }
]
},
{
"title": "Apple 98-2",
"sku": "apple-ninety-eight-2",
"price": 19.99,
"qty": 999,
"variations": [
{ "variant": "Quantity", "option": "2", "key": "", "variantType": "D" }
]
}
]
I only get this:
{
"title": "Apple 98-1",
"sku": "apple-ninety-eight-1",
"price": 19.99,
"qty": 999,
"variations": [
{ "variant": "Quantity", "option": "1", "key": "", "variantType": "D" }
]
}
- Debug Steps Taken:
- I confirmed that the output of the node in the Debug Panel seems correct (i.e., it outputs multiple items or an array).
- I tried different expressions, including:
{{ JSON.stringify($node["code to extract variants and create the json2"].json.map(item => item)) }}
But this returned undefined
.
3. I also attempted using a Function Node to aggregate outputs, but it didn’t resolve the issue.
Could you help me understand how to reference the full output of the node in JSON format so that it includes all items, not just the first one?
Thanks in advance for your assistance!
Best regards,