How to send JSON/RAW array wrapped in an object?

Describe the issue/error/question

I want to send an array named articles to mailjet using the mailjet node. The problem is I think I dont know how to send JSON arrays.

I tried to follow examples like this post The error: "Body Parameters" is no valid JSON but I can’t figure it out.

the screenshots attached should explain the issue. basically how do I wrap an array…

What is the error message (if any)?

Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm,, desktop app]:

Hi @thomastraum, sending arrays is unfortunately a bit tricky in n8n as the exact data structure required depends on the exact node (and service it connects to).

What happens in your example is that your expression is surrounded by plain text (even though that text looks like JSON). As a result, JavaScript will try to convert your array into a string which results in the [object Object] which is the plain text representation of an object.

In a first step you could ensure your expression returns actual JSON rather than plain text. To do so, make sure to wrap everything in {{ and }}. Like so:

{{ { "articles": $json["data_object"] } }}

This should return a raw JSON object as the expression itself isn’t surrounded by plain text. Make sure to also remove and leading and trailing whitespaces outside of {{ and }}.

1 Like

@MutedJam thanks for helping so much consistently. I keep learning. I decided to write the whole thing in node in a script.