JSON parameter need to be an valid JSON [item 0]

My http node has body json that doesn’t accept json inside this. Anyone tried to solve this before

{
  "max_tokens": 100,
  "messages": [
    {
      "content": "{{ $json.prompt }}",
      "role": "user"
    }
  ],
  "model": "gpt-4o-mini",
  "temperature": 1,
  "top_p": 1
}
  • **n8n version:self host
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via Docker
  • **Operating system:Window

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Hi @bmax911

Thanks for posting here and welcome to the community! :partying_face:

That looks like a bug… Thanks for reporting this! :pray:

Will post here when fixed.

Hey @bmax911

I hit the same problem with JSON within JSON - check out this article for a workaround as it worked great for me:

How to pass json inside a json property - Questions - n8n Community

Short version: you need to construct the whole JSON body as an expression within {{ }} brackets, as part of the HTTP Request node configuration.

Hope that helps you. It saved my bacon !

1 Like

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