The errors that break JSON most often
JSON is a deliberately strict format, and almost every parse failure comes down to one of a handful of things. Knowing them turns a cryptic error into a two-second fix.
- Trailing commas.
{"a":1,}is valid JavaScript and invalid JSON. This is the single most common cause of failures, usually from hand-editing. - Single quotes. JSON requires double quotes on both keys and string values.
{'a':1}will not parse. - Unquoted keys.
{a:1}is a JavaScript object literal, not JSON. - Comments. JSON has no comment syntax.
//and/* */both cause failures, which surprises people coming from config files. - Unescaped characters inside strings. A raw newline, tab or backslash inside a string must be escaped as
\n,\tor\\. - NaN and Infinity. Neither is a valid JSON number, even though JavaScript produces them.
Format or minify — when to use each
Formatting adds indentation and line breaks so a human can read the structure. Minifying strips every unnecessary byte of whitespace. Neither changes the data, so you can move between them freely.
For anything travelling over a network — API responses, config bundled into a page, data stored in a field — minify. The saving is usually 15–30% on structured data, and it costs nothing since machines do not care about indentation. Keep formatted JSON for files a person will open and edit, and let your version control system deal with the extra lines.
What escape and unescape do
Escaping turns your JSON into a single string value, with quotes and backslashes protected. This is what you need when JSON has to be embedded inside another JSON document, pasted into a string field, or passed as a command line argument. Unescape reverses it, which is the fastest way to read a nested payload someone has handed you as an opaque string.
Sorting keys
JSON objects have no guaranteed order, so sorting keys alphabetically is safe and does not change meaning. It is genuinely useful when you need to compare two documents that contain the same data in different orders — sort both, and a plain text diff becomes readable.
Frequently asked questions
Is my JSON sent to a server?
No. Parsing and formatting happen in your browser. This matters for JSON containing API keys, tokens or customer data — none of it leaves your machine.
Will it handle very large files?
Files up to a few megabytes format quickly. Beyond that the browser may pause while parsing, since the whole document is held in memory at once.
Can it fix broken JSON automatically?
No, and deliberately so. Guessing at what a malformed document meant risks silently changing your data. The error message tells you where parsing stopped so you can decide yourself.
Does it support JSON Lines or JSON5?
Not currently. This validates against the standard JSON specification, so comments, trailing commas and unquoted keys are reported as errors rather than accepted.