This post is about dynamically mapping Shopify order line items into a valid JSON array in n8n for creating invoices in Zoho Invoice without getting `[object Object]` errors

Describe the problem/error/question

The problem is that when mapping Shopify order line items in n8n to send them to Zoho Invoice, the JSON expression returns [object Object] instead of a proper JSON array of objects, causing the invoice creation to fail.

What is the error message (if any)?

The error isn’t a system error message but a data formatting issue — the output shows [object Object],[object Object] instead of a valid JSON array of objects in the line_items field.

Input JSON (Expression & Result)

{
“line_items”: [
{
“name”: “Hoodie”,
“quantity”: 1,
“price”: 145.00
},
{
“name”: “T Shirt”,
“quantity”: 1,
“price”: 89.00
}
]
}

Expected Output

“line_items”: [
{
“description”: “Hoodie”,
“rate”: 145,
“quantity”: 1
},
{
“description”: “T Shirt”,
“rate”: 89,
“quantity”: 1
}
]

Issue

When I try to map the data using this expression inside my HTTP Request node:

{{ $(‘New Paid Order’).item.json.line_items.map(li => ({
name: li.name,
quantity: li.quantity,
price: li.price
})) }}

…the result turns into

[object Object],[object Object]

instead of a proper JSON array of objects.

Please share your workflow

Share the output returned by the last node

{
“line_items”: [
{
“name”: “Hoodie”,
“quantity”: 1,
“price”: 145.00
},
{
“name”: “T Shirt”,
“quantity”: 1,
“price”: 89.00
}
]
}

Information on your n8n setup

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

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