entity.parse.failed API Origin: Application & API OSI layer 6 · Presentation Last updated 13 Oct 2026

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.

Exact message you may see Malformed JSONProblems parsing JSONJSON parse errorUnexpected token in JSON at positionRequest body is not valid JSON
Seen on: REST API

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

  1. Always build bodies with JSON.stringify / json.dumps, never by hand
  2. Validate the payload with a JSON linter
  3. Make the body and Content-Type match

Detailed fix by platform

Node.js

  1. await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) });

curl

  1. 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

  1. 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

  1. Raw body — Paste the exact bytes sent into a JSON validator
  2. Header — Content-Type matches the body format?
  3. 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:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

+ vs %20 — Query string space encoded as + vs %20 (wrong values, 404 or signature mismatch) (HTTP)+ vs %20204 — HTTP 204 No Content (HTTP)204400 — HTTP 400 Bad Request (HTTP)400411 — HTTP 411 Length Required (HTTP)411415 — HTTP 415 Unsupported Media Type (HTTP)415circular JSON — TypeError: Converting circular structure to JSON (JavaScript)circular JSONDecodingError — Swift DecodingError: keyNotFound / typeMismatch / valueNotFound / dataCorrupted (iOS)DecodingErrorEJSONPARSE — npm ERR! code EJSONPARSE — Failed to parse json / Unexpected token in JSON at position (npm)EJSONPARSEentity.pa…

Explore the map of this error Full error map →

🧠 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.