response, then the error is Invalid JSON in response body [1 comments, 2 participants]","description":"[n8n] Bug Description If HTTP Request node version 4.4 Latest returns JSON with a response containing , an error will be returned: Invalid JSON in response body Example {\"say\": \"\"} ### To Reproduce 1. create HTTP Request node version 4.4 (Latest) 2. send request to your API 3. return from your API {\"say\": \"\"} 4. \"Image\" ### Expected behavior I don't see the error, but what I sent via the API. ### Debug Info # Debug info ## core - n8nVersion: 2.17.8 - platform: docker (self-hosted) - nodeJsVersion: 24.14.1 - nodeEnv: production - database: postgres - executionMode: scaling (single-main) - concurrency: -1 - license: enterprise (production) - consumerId: 10198e77-db2e-49ea-8e2a-f0a4ef800468 ## storage - success: all - error: all - progress: false - manual: true - binaryMode: filesystem ## pruning - enabled: true - maxAge: 336 hours - maxCount: 10000 executions ## client - userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/146.0.0.0 safari/537.36 opr/130.0.0.0 (edition yx 08) - isTouchDevice: false Generated at: 2026-04-28T15:52:33.220Z ### Operating System Ubuntu 24 ### n8n Version 2.17.8 (Self Hosted) ### Node.js Version 24.14.1 ### Database PostgreSQL ### Execution mode main (default) ### Hosting self hosted","inLanguage":"en-US","datePublished":"2026-04-28T15:57:11Z","dateModified":"2026-04-28T15:57:11Z","mainEntityOfPage":{"@type":"WebPage","@id":"https://www.stepcodex.com/en/issue/if-you-return-json-with-script"},"author":{"@type":"Person","name":"AndreySep","url":"https://github.com/AndreySep","image":"https://github.com/AndreySep"},"publisher":{"@type":"Organization","name":"StepCodex","url":"https://www.stepcodex.com"},"articleSection":"n8n","about":[{"@type":"Thing","name":"n8n","url":"https://www.stepcodex.com/en/category/n8n"}],"contributor":[{"@type":"Person","name":"n8n-assistant[bot]","url":"https://github.com/n8n-assistant%5Bbot%5D","image":"https://github.com/n8n-assistant%5Bbot%5D"}],"keywords":"If you return JSON with a response, then the error is Invalid JSON in response body, n8n, how to fix, fix, troubleshooting, root cause, solution, StepCodex","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":0}},{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://www.stepcodex.com/en/issue"},{"@type":"ListItem","position":2,"name":"n8n","item":"https://www.stepcodex.com/en/category/n8n"},{"@type":"ListItem","position":3,"name":"If you return JSON with a response, then the error is Invalid JSON in response body","item":"https://www.stepcodex.com/en/issue/if-you-return-json-with-script"}]},{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"Expected behavior","acceptedAnswer":{"@type":"Answer","text":"I don't see the error, but what I sent via the API."}}]}]

n8n - 💡(How to fix) Fix If you return JSON with a <script></script> response, then the error is Invalid JSON in response body [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
n8n-io/n8n#29419Fetched 2026-04-29 06:35:03
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
closed ×1commented ×1labeled ×1renamed ×1

Error Message

If HTTP Request node version 4.4 (Latest) returns JSON with a response containing <script></script>, an error will be returned: Invalid JSON in response body I don't see the error, but what I sent via the API.

  • error: all
RAW_BUFFERClick to expand / collapse

Bug Description

If HTTP Request node version 4.4 (Latest) returns JSON with a response containing <script></script>, an error will be returned: Invalid JSON in response body

Example {"say": "<script></script>"}

To Reproduce

  1. create HTTP Request node version 4.4 (Latest)
  2. send request to your API
  3. return from your API {"say": "<script></script>"}
<img width="555" height="723" alt="Image" src="https://github.com/user-attachments/assets/bfd85784-98fb-4b81-8c3d-3c4912747fa8" />

Expected behavior

I don't see the error, but what I sent via the API.

Debug Info

Debug info

core

  • n8nVersion: 2.17.8
  • platform: docker (self-hosted)
  • nodeJsVersion: 24.14.1
  • nodeEnv: production
  • database: postgres
  • executionMode: scaling (single-main)
  • concurrency: -1
  • license: enterprise (production)
  • consumerId: 10198e77-db2e-49ea-8e2a-f0a4ef800468

storage

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: filesystem

pruning

  • enabled: true
  • maxAge: 336 hours
  • maxCount: 10000 executions

client

  • userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/146.0.0.0 safari/537.36 opr/130.0.0.0 (edition yx 08)
  • isTouchDevice: false

Generated at: 2026-04-28T15:52:33.220Z

Operating System

Ubuntu 24

n8n Version

2.17.8 (Self Hosted)

Node.js Version

24.14.1

Database

PostgreSQL

Execution mode

main (default)

Hosting

self hosted

extent analysis

TL;DR

The HTTP Request node in n8n version 2.17.8 may require additional configuration or handling to parse JSON responses containing HTML script tags.

Guidance

  • Verify that the API response is correctly formatted as JSON and that the <script></script> tags are properly escaped.
  • Consider using a JSON parsing library or function that can handle HTML entities within JSON strings.
  • Check the n8n documentation for any specific guidance on handling JSON responses with HTML content.
  • Test the API response with a tool like Postman or cURL to confirm that the issue is specific to the n8n HTTP Request node.

Example

No code example is provided as the issue is more related to configuration and handling of JSON responses.

Notes

The issue may be related to the way n8n handles JSON responses with HTML content. Further investigation into the n8n documentation and configuration options may be necessary to resolve the issue.

Recommendation

Apply workaround: Modify the API response to properly escape any HTML entities within the JSON string, or use a JSON parsing library that can handle HTML content. This will allow the HTTP Request node to correctly parse the response and avoid the "Invalid JSON in response body" error.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

I don't see the error, but what I sent via the API.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING