A8gent
All articles

Technical

JSON parameter need to be an valid JSON: 4 Causes and the Fix for Each in n8n

The HTTP Request node tried to parse the text in a JSON field and failed. Either the JSON itself has a syntax error, an expression dropped a value into it that broke the quoting, a field was missing on one item, or the bad JSON is in the headers or query box, not the body.

A8gentAutomation practiceNovember 17, 202611 min read
Contents
  1. The Short Answer
  2. What the Node Is Doing When It Fails
  3. Cause 1: The JSON Itself Has a Syntax Error
  4. Cause 2: An Expression Inserted Text That Broke the Quoting
  5. Cause 3: A Field Is Missing on Some Items
  6. Cause 4: The Bad JSON Is in the Headers or Query Field
  7. After It Parses: The Errors You May See Next
  8. How to Stop It Coming Back
  9. Sources
  10. FAQ

The Short Answer

"JSON parameter need to be an valid JSON" is raised by the HTTP Request node when a field you set to JSON does not contain valid JSON at the moment the node runs. The n8n docs list two things to check:

  1. Test your JSON in a JSON checker for missing quotation marks, extra or missing commas, badly formatted arrays, and extra or missing brackets.
  2. If you used an expression, make sure you wrapped the entire JSON in double curly brackets.

The second point is the one that fixes most real cases. Instead of dropping expressions into a hand-typed JSON string, make the whole body one expression that returns an object:

{{
  {
    "name": $json.name,
    "note": $json.note,
    "tags": ["lead", "website"]
  }
}}

Written this way, values with quotes or line breaks cannot break the syntax, because you are no longer assembling JSON by hand.

What the Node Is Doing When It Fails

In the HTTP Request node, turning on Send Body with Body Content Type set to JSON gives you two ways to specify the body. Using Fields Below takes name and value pairs and builds the JSON for you. Using JSON takes a block of JSON text. Query parameters and headers offer the same choice.

With Using JSON, the node resolves any expressions in the field, takes the resulting text, and parses it. You can see this in the node's source, HttpRequestV3.node.ts: a small function runs JSON.parse on the string and, if that throws, raises the node error with the parser's own message as the description.

The wording depends on your n8n version. All three of these are the same failure:

MessageWhere it appears
JSON parameter need to be an valid JSONThe n8n documentation and many existing installs
JSON parameter needs to be valid JSONWidely reported in community threads
The value in the "JSON Body" field is not valid JSONCurrent n8n source. The field name can also be "JSON Query Parameters" or "JSON Headers"

Two things follow from how the check works. First, n8n is not judging your template. It is judging the text after every expression has been filled in, which is why a body that looks fine in the editor can still fail. Second, the check runs per item. Community reports often show the message with a suffix such as [item 1], which tells you which input item produced the bad text.

Cause 1: The JSON Itself Has a Syntax Error

Start here because it takes thirty seconds to rule out. JSON is stricter than JavaScript, and the usual mistakes are small:

MistakeInvalidValid
Trailing comma{"a": 1, "b": 2,}{"a": 1, "b": 2}
Single quotes{'a': 'x'}{"a": "x"}
Unquoted key{a: 1}{"a": 1}
Curly "smart" quotes pasted from a document or chat{“a”: 1}{"a": 1}
Missing closing bracket{"a": [1, 2}{"a": [1, 2]}

How to confirm it: if the field contains no expressions, paste it into a JSON validator. The n8n docs link to JSONLint for this. If it contains expressions, copy the resolved result shown in the field's preview instead and validate that.

The fix: correct the character the validator points at. If you pasted the body from an API's documentation or from a chat window, retype the quotation marks. Curly quotes look almost identical on screen and are a recurring cause in community threads.

Cause 2: An Expression Inserted Text That Broke the Quoting

This is the cause behind most "it works with test data and fails in production" reports. The template looks correct:

{
  "subject": "{{ $json.subject }}",
  "message": "{{ $json.message }}"
}

Then a customer writes a message containing a double quote, or presses Enter twice. After n8n fills in the expressions, the text is no longer valid JSON: the quote inside the message ends the string early, and a raw line break is not allowed inside a JSON string at all. Short, tidy test values never trigger it.

How to confirm it: the node works for some items and fails for others, and the failing items contain quotes, line breaks, backslashes or tabs in a text field. Paste the resolved body for a failing item into a validator and it will point inside that value.

Fix A: make the whole body one expression. This is the approach in the n8n docs. Wrap the entire JSON in one pair of double curly brackets and reference values directly, without quotes or inner brackets:

{{
  {
    "subject": $json.subject,
    "message": $json.message
  }
}}

Fix B: stringify each value. If you prefer to keep the template style, let JSON.stringify() produce the quoted, escaped string for you, and remove your own quotation marks around it:

{
  "subject": {{ JSON.stringify($json.subject) }},
  "message": {{ JSON.stringify($json.message) }}
}

The mistake to avoid with Fix B is leaving the outer quotes in place. JSON.stringify() already returns the value with quotes around it, so "{{ JSON.stringify($json.message) }}" gives you two sets and fails again. The same function is the right way to insert an object or an array from a previous node.

Fix C: let n8n build it. If the body is a flat list of fields, switch Specify Body to Using Fields Below and enter each name and value. There is no JSON text for a value to break. The trade-off is that nested objects and arrays are awkward to express this way.

Cause 3: A Field Is Missing on Some Items

If the error message ends with an item number, the template is fine for most items and one item's data broke it. The n8n docs describe the same failure for JSON mode in the Edit Fields node: check that your JSON object does not reference undefined input data, which may occur if the incoming data does not always include the same fields.

Typical sources are optional form fields, CRM properties that are only present when filled in, and API responses that omit keys rather than sending them empty.

How to confirm it: open the input of the HTTP Request node, go to the item number named in the error, and compare its fields with an item that worked. Look for the field your expression reads.

The fix is to decide what should be sent when the value is absent, and say so in the expression. With the whole-body style from Cause 2:

{{
  {
    "email": $json.email,
    "phone": $json.phone || null,
    "company": $json.company || ""
  }
}}

Check the receiving API's documentation before choosing between null, an empty string, and leaving the key out. They are not interchangeable, and some APIs reject null for a field they treat as optional. If the right behaviour is to skip the request entirely when a required value is missing, put an If node before the HTTP Request node and route those items elsewhere.

Cause 4: The Bad JSON Is in the Headers or Query Field

People spend a long time fixing a body that was never broken. The node uses the same parsing step for three fields: the JSON body, the JSON query parameters and the JSON headers. The documented message does not say which field failed, so nothing points you away from the body. Current source names the field in the message.

A community thread on this exact error went through several rounds on the body before the tester concluded the problem was the header JSON. Once the headers were rebuilt as an expression using JSON.stringify on an object, the JSON error went away and the request reached the API, which then returned its own authentication error.

How to confirm it: check whether Send Headers or Send Query Parameters is on and set to Using JSON. Validate the resolved text of each one separately.

The fix: apply the same rules to those fields. For headers, the fields mode is usually simpler and safer:

  • Set Specify Headers to Using Fields Below and add Content-Type and any others as name and value pairs.
  • Put API keys in an n8n credential, not in a header typed into the node. The HTTP Request docs recommend the predefined credential type when one exists.

After It Parses: The Errors You May See Next

Fixing the JSON means the request finally leaves n8n. The next error, if there is one, comes from the API and means something different. n8n maps the common status codes to fixed messages:

MessageStatusWhat to check
Bad request - please check your parameters400The JSON is valid but the API does not accept it: a wrong field name, a wrong type, or a missing required field.
Authorization failed - please check your credentials401The credential or the authorization header.
Forbidden - perhaps check your credentials?403Permissions or scopes on the key.
The service is receiving too many requests from you429Pacing. See our guide to the 429 error.

A 400 straight after fixing the JSON is common and is progress. One frequent reason: the cURL import in the HTTP Request node always imports parameter values as strings. The n8n docs say that to keep numbers and booleans in their original types, you should switch from Using Fields Below to Using JSON and paste the JSON object. An API expecting "quantity": 2 may reject "quantity": "2".

How to Stop It Coming Back

Never assemble JSON by typing quotes around expressions. Use one expression that returns an object, or JSON.stringify() per value. This single habit removes Cause 2, which is the one that fails in production weeks after launch.

Shape the data before the request. Put an Edit Fields node before the HTTP Request node that produces exactly the fields the API wants, with defaults applied. The request body then becomes a short expression over clean data, and when something is wrong you can see it in the Edit Fields output. The n8n docs recommend the same split: prepare data in Edit Fields rather than scattering complex expressions across node parameters.

Test with ugly data. Before publishing, run the workflow with an item that has a quotation mark, a line break and an emoji in a text field, and with one where every optional field is empty.

Alert on failure. Set an error workflow in Workflow Settings so a failed execution reaches you. Bad input data will arrive eventually, and you want to hear about it from n8n. See error handling.

Calling APIs cleanly from the HTTP Request node is most of what makes an n8n workflow dependable, and it is the same skill you need when the node is attached to an AI agent as a tool. The n8n AI Agents course covers it with real request bodies, and our n8n platform review explains where the HTTP Request node fits against built-in app nodes. For a worked build, see the n8n AI Agent tutorial.

Sources

Checked against n8n's documentation, source code and community forum on 17 November 2026.

FAQ

What does "JSON parameter need to be an valid JSON" mean in n8n?
The HTTP Request node could not parse the text in a field set to Using JSON. It checks the text after all expressions have been resolved, so the problem can be a plain syntax error or a value inserted by an expression that broke the syntax. The wording, including the grammar mistake, is n8n's own.
How do I use an expression inside a JSON body in the n8n HTTP Request node?
The n8n docs say to wrap the entire JSON in double curly brackets. Write the body as one expression that returns an object, for example {{ { "name": $json.name } }}, and reference values directly without their own quotes or brackets.
Why does my JSON body work in testing but fail on real data?
Real text contains characters that test values do not, mainly double quotes and line breaks. Inserted into a hand-written JSON string, they end the string early or make it invalid. Use JSON.stringify($json.field) without surrounding quotes, or build the whole body as one object expression.
What does [item 1] after the error mean?
It is the index of the input item whose resolved text failed to parse. The node checks each item separately, so only that item's data is the problem. Open the node's input, find that item, and look for a missing field or unusual characters.
My body is valid JSON and I still get the error. Why?
Check the other JSON fields. The same check runs on JSON headers and JSON query parameters, and the documented message does not say which field failed. Also make sure you validated the resolved result of the field, not the template with expressions still in it.
Is "The value in the JSON Body field is not valid JSON" the same error?
Yes. That is the wording in current n8n source for the same parsing failure. It names the field, which can be JSON Body, JSON Query Parameters or JSON Headers, and includes the parser's message as the description.

If this resonated

Module 02 is the long version of this post.

Eval set, refusal pattern, kill switch. Build it in a weekend.

All postsLast verified 2026-11-17

Done for you

Want this built for your business?

Tell us the workflow. We scope, build, and ship the agent with guardrails and the numbers to prove it worked. The scoping call is free.

Free scoping call. You own the code.

Request a scoping call