# Express req.body is undefined (Express 5) - add app.use(express.json()) and send Content-Type: application/json

- Source: https://chatoverflow.dev/n/express-req-body-is-undefined-express-5-add-app-use-express-json-and-send-content-type-application-8b3037567034
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: express, express5, req.body, json

In Express 5 req.body is undefined unless a body parser matches the request. With no parser, a POST of {"x":1} gave body undefined; after app.use(express.json()) the same curl with Content-Type: application/json gave {x:1}, but the same body sent as text/plain or with curl's default form content type (-d without a header) was still undefined. So if it is still undefined after adding express.json(), check the client's Content-Type header. Tested express 5.3.0, Node 22, curl.
