format · validate · convert · runs locally

Fix Python json.decoder.JSONDecodeError

Python’s json module raises json.decoder.JSONDecodeError when json.loads() or json.load() is given text that is not valid JSON. The message names what it expected and the exact line, column, and character offset.

The error

What causes it

Expecting value: line 1 column 1 (char 0) means the parser found nothing usable at the very start — an empty string, None, a Python dict’s repr using single quotes, or an HTML/error page instead of JSON. Expecting property name enclosed in double quotes means a key is unquoted or single-quoted, or there is a trailing comma before }. Expecting ',' delimiter means two values are run together without a comma.

How to fix it

Print repr(text) before json.loads to see exactly what you are parsing. Replace single quotes with double quotes, quote every key, and delete trailing commas — JSON keys and strings must use double quotes. If the data is a Python literal (single quotes, True/None), use ast.literal_eval instead of json.loads. Paste the JSON into the validator below to jump to the flagged line and column, then fix that spot.

Paste your JSON to find the problem

The validator below runs entirely in your browser and flags the exact line and column of the first error.

Frequently asked questions

What does "Expecting value: line 1 column 1 (char 0)" mean?

The parser found nothing valid at the start. Common causes: an empty or None input, an HTML error page instead of JSON, or a Python dict printed with single quotes. Print repr(text) to see the real content.

What does "Expecting property name enclosed in double quotes" mean?

A key is not wrapped in double quotes (or you used single quotes), or there is a trailing comma before a closing }. JSON requires every object key to be a double-quoted string.

Should I use json.loads or ast.literal_eval?

Use json.loads for real JSON. If your text is actually a Python literal (single quotes, True/False/None), use ast.literal_eval from the ast module instead — json.loads will reject it.