
Fixing JSON With Unescaped Newlines in Strings Safely
A raw newline, tab or backslash inside a JSON string is invalid. See the errors Python and Node give, how strict=False helps and how to write strings safely.
Nested, loosely typed and everywhere. Query it, flatten it, validate it and store it without losing what the nesting meant.

A raw newline, tab or backslash inside a JSON string is invalid. See the errors Python and Node give, how strict=False helps and how to write strings safely.

A UTF-8 byte order mark in front of JSON breaks strict parsers in Python and Node. What the three bytes are, who adds them and how to read or remove them.

Extra data means a valid JSON value was followed by more text. Why concatenated objects and JSON Lines trigger it and three ways to read them in Python.

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.

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.

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.

JSON needs double quotes, but a Python repr or JavaScript literal uses single quotes. What each parser says, why replacing quotes breaks, and safe fixes.

Unexpected end of JSON input means the text stopped too soon or was empty. Real messages for every cut point, and how to tell truncated from empty.

An unexpected token error at position 0 means the text is not JSON: usually an HTML error page, the word undefined or an unparsed object. How to tell which.

How to read a JSON parse error: what the position means in Python, Node, PHP and jq, twelve common causes, and a method that finds the bad byte fast.
We send one email when a new article is published. No spam.