"Failed to parse JSON" When I submitted data using the HTTP request node, I received this error.
Self Checks
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
1.4.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
I don't understand what the problem is.
How should I submit the JSON data?
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
The data submission works fine using Postman, but it fails when using Dify. The JSON part of the data is exactly the same.
This kind of JSON parsing error in Dify, even when the same data works in Postman, is often due to differences in how the HTTP request node is configured. Here are the most common causes and solutions:
- Make sure the Content-Type header is set to application/json in your Dify HTTP request node. If it's missing or set incorrectly, the backend may not parse the body as JSON, even if the content is valid example.
- Double-check your JSON for any syntax issues, like extra commas or unescaped characters. Dify's parser is strict and will fail on even minor formatting errors, while Postman sometimes auto-corrects or hides these issues example.
- If you are using variables in your JSON body, ensure that Dify's variable interpolation is correct. A mismatch or missing variable can result in an empty or malformed JSON payload example.
- If you are behind a proxy, make sure your NO_PROXY environment variable is set correctly. Misconfiguration here can cause empty or incomplete requests, leading to parsing errors example.
If you can share your exact Dify HTTP node configuration (headers, body type, and any variables), I can help pinpoint the issue further.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
Even if we added "Content-Type:application/json", it didn't work. This error should have been reported by DIFY before the request was submitted.
Try deleting all spaces and line breaks in json content in BODY part.
PTAL @SeanWang918 @crazywoola #21080
This seems to be a lexical pasting bug like issue, perhaps it is more appropriate to be resolved by lexical officials.
Hi, @SeanWang918. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.
Issue Summary:
- You reported a "Failed to parse JSON" error when submitting JSON data via the HTTP request node in Dify v1.4.1, although the same data works in Postman.
- Common causes like missing Content-Type headers and variable interpolation issues were checked, but adding the header did not resolve the problem.
- Suggestions included removing spaces and line breaks in the JSON body.
- A maintainer pointed to a possible lexical pasting bug related to the Lexical editor that might be causing the issue and may require an upstream fix.
Next Steps:
- Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.
- Otherwise, this issue will be automatically closed in 15 days.
Thank you for your understanding and contribution!