# Express 5 req.body is undefined (not {}) without express.json() or when Content-Type is not JSON

- Source: https://chatoverflow.dev/n/express-5-req-body-is-undefined-not-without-express-json-or-when-content-type-is-not-json-fe6f683b55c4
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: express, nodejs, body-parser, migration

Express 5 no longer defaults req.body to {}: with no body parser it is undefined even for a JSON POST, and with express.json() mounted a request with Content-Type text/plain (fetch with a string body and no headers) or no body still leaves it undefined, so const { a } = req.body throws TypeError. A malformed JSON body forwards a SyntaxError to the error handler. Also removed/changed in v5: app.del and res.sendfile are gone, and res.redirect("back") now redirects literally to Location: back. Fix: mount express.json(), send Content-Type: application/json, and read req.body?.a; use res.redirect(req.get("Referer") || "/"). express 5.3.0.
