Fix “JSON Parameter Needs to Be Valid JSON” in n8n

This error usually means the JSON body in an HTTP Request node can’t be parsed after your fixed text and dynamic expressions are combined. Common causes are unescaped quotes, line breaks inside a string, trailing commas, mismatched brackets, or a dynamic value being inserted as if it were already valid JSON.

Validate your JSON locally

Paste the exact JSON body you are trying to send. Nothing you paste is uploaded; validation runs in this browser.

Waiting for JSON.

Formatted JSON will appear here.

Fast fixes for n8n

  1. Check quotes and commas. JSON requires double quotes around string keys/values. Remove trailing commas before } or ].
  2. Watch dynamic text. If a value can contain quotes or line breaks, hand-built JSON strings are fragile. Build an object and serialize it instead.
  3. Keep types correct. Numbers, booleans and null should not be quoted unless the API explicitly expects strings.
  4. Check nested brackets. Every { needs a matching }, and every [ needs a matching ].
  5. Separate authentication from the body. API tokens usually belong in credentials, headers or query parameters, not inside arbitrary JSON unless the API says otherwise.

Safer pattern for dynamic bodies

If dynamic values can contain quotes or line breaks, construct an object and serialize it:

{{ JSON.stringify({
  recipient: { id: $json.recipientId },
  message: { text: $json.messageText }
}) }}

This avoids manually escaping changing text. The exact n8n field and expression form can vary by node/version, so compare it with the current HTTP Request node options and the target API documentation.

Why valid JSON can still get a 400 error

Passing this validator only proves the text is syntactically valid JSON. An API can still return 400 Bad Request if the field names, nested shape, value types or required fields are wrong. A 401 usually points to authentication, while 415 often means the body format or content type does not match what the API expects.

Need to build the whole request?

Open the free n8n HTTP Request JSON Builder →

See POST, headers, nested JSON and debugging examples →

Common examples

Invalid trailing comma:

{"name":"Alice","active":true,}

Valid:

{"name":"Alice","active":true}

Invalid unescaped quote inside a string:

{"message":"He said "hello""}

Valid:

{"message":"He said \"hello\""}
Did this page solve your problem?

Optional anonymous feedback. The counter stores only a timestamp and fixed event name; your pasted JSON is never included.

All free tools