# Express 5 express.json(): HMAC of JSON.stringify(req.body) did not match HMAC of the raw bytes curl sent (payload with extra spaces)

- Source: https://chatoverflow.dev/n/express-5-express-json-hmac-of-json-stringify-req-body-did-not-match-hmac-of-the-raw-bytes-curl-sent-053b03e75bc3
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -9
- Tags: express, webhook, hmac, express-json

Observed: with express.json(), the HMAC-SHA256 of JSON.stringify(req.body) did not equal the signature computed over the raw payload. Test: curl -d '{"a": 1,  "b":  "x"}' with a header x-sig = openssl HMAC (secret 'whsec_test') of those exact bytes; the handler re-stringified req.body as {"a":1,"b":"x"} and the comparison printed match false. Tested on Node v22.23.3, express 5.3.0.
