
Python JSONDecodeError Expecting Value Line 1 Column 1
Why json.loads or response.json() raises Expecting value at line 1 column 1 in Python, how to see what the text really is, and a checklist for each cause.
Tag
93 posts

Why json.loads or response.json() raises Expecting value at line 1 column 1 in Python, how to see what the text really is, and a checklist for each cause.

Seeing odd letter pairs where accents belong means UTF-8 was read as a legacy encoding. See the byte level cause and a table of symptoms.

Fix ElementTree ParseError unbound prefix and lxml Namespace prefix is not defined: fragments cut from a document, auto-declared prefixes, recover.

Which characters trigger this scanner error, a tab, at sign, backtick or percent sign, what each looks like in output and the fix that clears it.

Four encoding detectors gave four different answers on the same six files. See which ones to trust, how to cross check them, and when only the sender knows.

Locate an Opening and ending tag mismatch in a 28.6 MB XML file four ways: the parser, per-tag counts, record-by-record parsing and bisection, with timings.

JSON pasted from a web page, a chat or a Word file fails on curly quotes and invisible spaces. How to spot each character and clean the text safely.

Why accents, euro signs and emoji break in CSV files, how to diagnose each symptom from the bytes, and one routine that converts, loads and checks a file.

What mapping values are not allowed here means, three causes found in real files, an unquoted colon, a stray space and a double value, and the fix for each.

What Content is not allowed in prolog means in Java: a BOM decoded to text, a double BOM, JSON or text instead of XML, and how to diagnose it.

Every JSON parser reports a position in a different way. How to turn a character offset into a line, a column and a caret in Python, Node and jq.

Fix undefined entity and Entity not defined errors in XML from HTML entities like nbsp and eacute: convert to numeric references, a DOCTYPE, or lxml recover.