JSON WalletPrivacy-first JSON & API workspace

Fix "Expecting value: line 1 column 1 (char 0)" (Python)

Python ยท JSON error

โ† All tools

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)Expecting value: line 1 column 1 (char 0)simplejson.errors.JSONDecodeError: Expecting value

Opens the editor with a broken example loaded and repaired, entirely in your browser โ€” nothing is uploaded.

What causes it

json.loads() raises JSONDecodeError: Expecting value when the text it receives does not begin with a valid JSON value. "Line 1 column 1 (char 0)" means the problem is at the very first character, which almost always means the input is not JSON at all:

  • Empty input โ€” json.loads('') or a response with no body.
  • An HTML or plain-text response โ€” you called response.json() on a requests result that returned an error page. Print response.text and response.status_code first.
  • Python literals, not JSON โ€” single quotes, None, True/False, or a trailing comma copied from a Python dict. Those are not valid JSON.

How to fix it

  1. Print repr(text) right before json.loads() to see whether it is empty or not JSON.
  2. For requests, check response.status_code and response.headers['content-type'] before calling .json().
  3. If the text uses single quotes, None, True or False, it is a Python literal โ€” convert to valid JSON (double quotes, null, true/false).
  4. Paste the text into JSON Wallet to convert Python-style pseudo-JSON into strict, valid JSON.

Before and after

Broken:

{'name': 'Ada', 'active': True, 'note': None}

Fixed:

{"name": "Ada", "active": true, "note": null}

Want to fix your own JSON instead of the example? Open the editor, paste it in, and click Repair โ€” it runs entirely in your browser.

Frequently asked questions

Why does char 0 mean the whole thing is wrong?

"char 0" is the first character. If the parser fails there, it never found a valid JSON value to begin with โ€” the input is empty or is not JSON, rather than having a small typo deeper in.

My data uses single quotes and True/False โ€” is that JSON?

No. That is a Python dict printed as a string. JSON requires double quotes and lowercase true/false/null. Convert it before parsing.


Related JSON errors

For a full reference of JSON mistakes, read Common JSON errors and how to fix them.

Press โŒ˜ K for commands