json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The text passed to json.loads() isn’t JSON — at char 0 it’s usually empty or HTML.
Seen on:
Python
Meaning
“Expecting value … (char 0)” means the very first character isn’t valid JSON: an empty response, an HTML error page, or a BOM. requests’ response.json() raises the same error.
Common causes
- Empty response body (204, error)
- HTML error/login page instead of JSON
- File with BOM (use utf-8-sig)
- Single quotes / Python dict repr instead of JSON
⚡ Quick fix
- Print response.status_code and response.text[:200] before parsing
- Check Content-Type
- Use json.loads(s) only on real JSON; ast.literal_eval for Python reprs
Detailed fix by platform
Python
- python
r = requests.get(url, timeout=10) r.raise_for_status() data = r.json()
How to diagnose
- Raw — What is the text?
- Status — HTTP status code?
🧠 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026