# HTTPRequest sending single variable as JSON

**URL:** <https://community.n8n.io/t/httprequest-sending-single-variable-as-json/303831>\
**Category:** Questions\
**Tags:** workflow-building\
**Created:** [July 19, 2026, 3:49am UTC](https://community.n8n.io/t/httprequest-sending-single-variable-as-json/303831 "2026-07-19T03:49:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![GeoForeman](https://avatars.discourse-cdn.com/v4/letter/g/90ced4/32.png) [@GeoForeman](https://community.n8n.io/u/GeoForeman)\
**Post date:** [July 19, 2026, 3:49am UTC](https://community.n8n.io/t/httprequest-sending-single-variable-as-json/303831/1 "2026-07-19T03:49:27Z")

</div>

## Describe the problem/error/question

## What is the error message (if any)? Bad request - please check your parameters

## Please share your workflow

{  
“nodes”: [  
{  
“parameters”: {  
“method”: “POST”,  
“url”: “[http://host.docker.internal:8082/api/assistant/intent](http://host.docker.internal:8082/api/assistant/intent)”,  
“sendHeaders”: true,  
“headerParameters”: {  
“parameters”: [  
{  
“name”: “Content-Type”,  
“value”: “application/json”  
},  
{  
“name”: “Accept”,  
“value”: “application/json”  
}  
]  
},  
“sendBody”: true,  
“contentType”: “raw”,  
“body”: “={{ $json.cleanOutput }}”,  
“options”: {}  
},  
“type”: “n8n-nodes-base.httpRequest”,  
“typeVersion”: 4.4,  
“position”: [  
240,  
-112  
],  
“id”: “bc555ae5-8565-4c9b-b871-4d3f4a20899b”,  
“name”: “HTTP Request”  
}  
],  
“connections”: {},  
“pinData”: {},  
“meta”: {  
“templateCredsSetupCompleted”: true,  
“instanceId”: “02f1001f8f2d972f69be23b2f2dcfdcc65885dd6f6ff6d04c911329ee6f7f3dd”  
}  
}

## 

## Information on your n8n setup

- **n8n version: latest / local**
- **Database (default: SQLite): N/A**
- **n8n EXECUTIONS\_PROCESS setting (default: own, main): default**
- **Running n8n via (Docker, npm, n8n cloud, desktop app): Docker**
- **Operating system: Windows 10**

---

<div class="post-metadata">

**Author:** ![kjooleng](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/kjooleng/32/184045_2.png) [@kjooleng](https://community.n8n.io/u/kjooleng)\
**Post date:** [July 19, 2026, 4:09am UTC](https://community.n8n.io/t/httprequest-sending-single-variable-as-json/303831/2 "2026-07-19T04:09:24Z")

</div>

Hi @GeoForeman

Change your **Body** field to this:

```auto
{
  "intent": "{{ $json.cleanOutput }}"
}

```

_(Replace `"intent"` with the actual key name required by your API)._

---

<div class="post-metadata">

**Author:** ![Anshul\_Namdev](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/anshul_namdev/32/178229_2.png) [@Anshul\_Namdev](https://community.n8n.io/u/Anshul_Namdev)\
**Post date:** [July 19, 2026, 9:10am UTC](https://community.n8n.io/t/httprequest-sending-single-variable-as-json/303831/3 "2026-07-19T09:10:00Z")

</div>

Hi @GeoForeman Welcome!  
Content type raw sends the literal value of the expression as the body. If `cleanOutput` isn’t already valid JSON, `host.docker.internal:8082` receives plain text under a `Content-Type: application/json` header, and its parser rejects it before your endpoint logic runs.  
Wrap the value with `JSON.stringify` instead of typing quotes around the expression, manual quoting breaks the moment `cleanOutput` contains a quote or newline:

```auto
{{ JSON.stringify({ yourKey: $json.cleanOutput }) }}

```

Since this is your own local service, its actual response body or server log will show the real validation reason instead of n8n’s generic message.

> <https://github.com/n8n-io/n8n/issues/19442>
>
> \## Describe the problem/error/question
> 
> HTTP request node configured as RAW and …application/json. The expression preview keeps showing a string instead of a JSON and an output error appears all the times.
> 
> \## What is the error message (if any)?
> 
> Bad request - please check your parameters
> Error on line 1: invalid JSON, near column 1: unexpected character: '"'; expected '{'
> 
> Error code
> 
> 400
> 
> Full message
> 
> 400 - "{\\n \\"error\\": {\\n \\"code\\": 400,\\n \\"message\\": \\"Error on line 1: invalid JSON, near column 1: unexpected character: '\\\\\\"'; expected '{'\\",\\n \\"status\\": \\"INVALID\_ARGUMENT\\"\\n }\\n}\\n"
> 
> Request
> 
> { "body": "{\\"batch\\":{\\"display\_name\\":\\"n8n-videos-batch\\",\\"input\_config\\":{\\"file\_name\\":\\"files/l2mafixz7ocf\\"}}}", "headers": { "x-goog-api-key": "XXXXXXXXXXXXXX", "content-type": "application/json", "accept": "application/json,text/\*;q=0.99" }, "method": "POST", "uri": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:batchGenerateContent", "gzip": true, "rejectUnauthorized": true, "followRedirect": true, "resolveWithFullResponse": true, "followAllRedirects": true, "timeout": 300000, "json": false, "useStream": true }
> 
> \## Please share your workflow/screenshots/recording
> 
> This is the RAW expression:
> {{
> JSON.stringify({
> batch: {
> display\_name: "n8n-videos-batch",
> input\_config: {
> file\_name: $json.batchInputFile // e.g. "files/zmqnybl6eb2d"
> }
> }
> })
> }}
> 
> \`\`\`
> (Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
> ⚠️ WARNING ⚠️ If you have sensitive data in your workflow (like API keys), please remove it before sharing.
> \`\`\`
> 
> 
> \## Share the output returned by the last node
> 
> 
> 
> \## Debug info
> 
> \### core
> 
> \- n8nVersion: 1.110.1
> \- platform: docker (cloud)
> \- nodeJsVersion: 22.19.0
> \- database: sqlite
> \- executionMode: regular
> \- concurrency: 5
> \- license: community
> 
> \### storage
> 
> \- success: all
> \- error: all
> \- progress: false
> \- manual: true
> \- binaryMode: filesystem
> 
> \### pruning
> 
> \- enabled: true
> \- maxAge: 168 hours
> \- maxCount: 2500 executions
> 
> \### client
> 
> \- userAgent: mozilla/5.0 (windows nt 10.0; win64; x64; rv:142.0) gecko/20100101 firefox/142.0
> \- isTouchDevice: false
> 
> Generated at: 2025-09-11T21:56:31.840Z}

---

<div class="post-metadata">

**Author:** ![GeoForeman](https://avatars.discourse-cdn.com/v4/letter/g/90ced4/32.png) [@GeoForeman](https://community.n8n.io/u/GeoForeman)\
**Post date:** [July 20, 2026, 4:03am UTC](https://community.n8n.io/t/httprequest-sending-single-variable-as-json/303831/4 "2026-07-20T04:03:24Z")

</div>

Thanks it worked

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [July 27, 2026, 4:04am UTC](https://community.n8n.io/t/httprequest-sending-single-variable-as-json/303831/5 "2026-07-27T04:04:11Z")

</div>

Closed on July 27, 2026, 4:04am UTC

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