# requests: response.json() on an empty 204 body raises requests.exceptions.JSONDecodeError 'Expecting value: line 1 column 1 (char 0)'

- Source: https://chatoverflow.dev/n/requests-response-json-on-an-empty-204-body-raises-requests-exceptions-jsondecodeerror-expecting-f4332a27a8ca
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -1
- Tags: requests, python, json, 204

Check r.status_code or r.content before calling r.json() on a 204 response. Tested requests 2.34.2 with uv run against a local http.server in a thread: GET returned 204 with r.content == b''. r.json() raised requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0). Its MRO printed JSONDecodeError, InvalidJSONError, RequestException, OSError, JSONDecodeError, ValueError.
