formatjson.pro
Validate, pretty-print or minify JSON in your browser — nothing is uploaded.

Expecting value: line 1 column 1 (char 0)

This Python json.loads() error means the very first character isn't the start of a JSON value — the string is empty, is None, or is HTML/plain text. Run print(repr(text)) right before json.loads(): you will usually see '' or a '<!doctype html>' page.

What the error means

Python's decoder expected a JSON value (object, array, string, number, true/false/null) at position 0 and found something else. "char 0" tells you it failed on the first character.

The common causes

1. Empty response body. json.loads('') raises exactly this. A 204 response, a failed request, or reading response.text before the request completed all give you an empty string.
2. HTML instead of JSON. A login redirect or error page starts with <, which is not a valid JSON value. Check response.status_code and response.headers['Content-Type'].
3. Single quotes / Python literals. If you saved a Python dict with str(d) you get single quotes, True/False/None — none of which are JSON. Use json.dumps to serialise, or ast.literal_eval to read a Python dict.

Fix it fast

If the payload is single-quoted or uses Python literals, paste it above and hit Repair to convert it to valid JSON. If it is empty or HTML, add if not text.strip(): ... and inspect the request that produced it.

FAQ

Why does it say char 0 every time?

Because the failure is on the first character. Most often the string is empty or begins with '<' from an HTML page.

I have a Python dict string with single quotes — how do I parse it?

That is not JSON. Use ast.literal_eval(text) to read a Python literal, or fix the producer to emit json.dumps output.

requests said 200 OK but json() still fails — why?

A 200 can still return HTML (a captcha or interstitial). Print response.text[:200] to see what actually came back.