API Error: Malformed JSON in request body (entity.parse.failed / JSON parse error)
The server couldn’t parse the request body as JSON, so it rejected the request before looking at any field.
Malformed JSONProblems parsing JSONJSON parse errorUnexpected token in JSON at positionRequest body is not valid JSON Meaning
This is the server-side twin of the browser’s “Unexpected token in JSON” error: the bytes your client sent are not valid JSON. Express/body-parser reports it as type entity.parse.failed, Spring as “JSON parse error”, Django REST Framework as “JSON parse error - Expecting value”, and many APIs simply say “Malformed JSON” or “Problems parsing JSON”.
Typical culprits are hand-built JSON strings, single quotes, trailing commas, an object passed without JSON.stringify (sent as “[object Object]”), or a body sent as form data while the header says application/json.
Common causes
- Body built by string concatenation (unescaped quotes, newlines)
- Single quotes or trailing commas (valid in JS, invalid in JSON)
- Object sent without JSON.stringify → "[object Object]"
- Content-Type: application/json but the body is form-encoded or empty
- Shell quoting in curl mangled the JSON
⚡ Quick fix
- Always build bodies with JSON.stringify / json.dumps, never by hand
- Validate the payload with a JSON linter
- Make the body and Content-Type match
Detailed fix by platform
Node.js
await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) });
curl
- bash
# put the JSON in a file to avoid shell quoting problems curl -X POST https://api.example.com/v1/items -H 'Content-Type: application/json' --data @body.json
Express
- bash
app.use(express.json()); app.use((err, req, res, next) => { if (err.type === 'entity.parse.failed') return res.status(400).json({ error: 'Malformed JSON' }); next(err); });
How to diagnose
- Raw body — Paste the exact bytes sent into a JSON validator
- Header — Content-Type matches the body format?
- Client — Was the object stringified?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in API
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 13 Oct 2026