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.
Expecting value: line 1 column 1 (char 0)Expecting property name enclosed in double quotes 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 not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- DecodingError Swift DecodingError: keyNotFound / typeMismatch / valueNotFound / dataCorrupted
- entity.parse.failed API Error: Malformed JSON in request body (entity.parse.failed / JSON parse error)
- HttpMessageNotReadableException HttpMessageNotReadableException: JSON parse error / Required request body is missing
Most viewed in Python
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 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.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 12 Oct 2026