n8n API Call Issue: Array Parameter Being Converted to String Instead of Valid JSON List

I’m having trouble with an n8n workflow where I need to send data to an external API. The API expects a parameter called conversations to be a proper JSON array, but n8n keeps converting it to a string format.

What I’m trying to do:

  • Send HTTP POST request to external chat API
  • Include conversations parameter as JSON array
  • Array should contain objects like [{"type": "human", "text": "hello"}]

Current problem:
Getting 400 error saying “conversations: Input should be a valid list”

Methods I’ve tested:

  1. JSON Body with Fields Below:

    conversations: [{"type": "human", "text": "hello"}]
    

    Result: Sends as string instead of array

  2. Raw JSON Body:

    {
      "model": "chat-model-v2",
      "conversations": [{"type": "human", "text": "hello"}]
    }
    

    Result: Same validation error

  3. Expression format:

    ={{ [{"type": "human", "text": "hello"}] }}
    

    Result: Shows [object Object] in the request

Setup details:

  • Using n8n cloud version
  • HTTP Request node
  • Content-Type set to application/json
  • Authentication works fine for other endpoints

Anyone know how to make n8n send actual JSON arrays instead of stringified versions? Is there a specific setting or node configuration I’m missing?

Had this exact issue last month and it drove me crazy for hours. The problem’s usually how you’re building the expression syntax. Don’t use the array directly - wrap it with JSON.parse() and JSON.stringify() properly. What worked for me was setting the HTTP Request node to “Raw JSON” mode and using this format: ={{ JSON.stringify({ "model": "chat-model-v2", "conversations": JSON.parse('[{"type": "human", "text": "hello"}]') }) }} If you’re pulling data from previous nodes, make sure you’re accessing the array property right with something like {{ JSON.stringify({conversations: $json.yourArrayField}) }}. The key is making n8n treat it as actual JSON structure, not a string. Also double-check your Content-Type header is exactly “application/json” without extra spaces.

use the Code node instead of expressions - it’s way more reliable for complex data structures. just do return {"model": "chat-model-v2", "conversations": [{"type": "human", "text": "hello"}]}; and reference that output in your HTTP node. expressions get wonky with nested objects.

I’ve hit this exact serialization bug with n8n’s HTTP node before. Here’s what fixed it for me: use a Set node to build your payload first, then pass it to the HTTP Request node. In the Set node, create your conversations array with ={{ [{"type": "human", "text": "hello"}] }} in the expression editor. Then reference it in the HTTP node with ={{ $json.conversations }}. The Set node handles data types properly while the HTTP node screws up complex structures when you build them inline. Also double-check if your API wants those conversations wrapped in quotes or not - some are really picky about that.