JSON Explained: What It Is, Why It Breaks, and How to Fix It
JSON runs the modern web, but a single misplaced comma can break an entire file. Here is what JSON is, the handful of rules it enforces, and why your file refuses to parse.
If you have worked with web APIs, configuration files, or modern apps, you have run into JSON — and probably into a JSON error that stopped everything over what looked like nothing. JSON is simultaneously the most widely used data format on the web and one of the strictest, which is exactly why a single stray character can make a whole file unreadable. Understanding its small set of rules makes those errors quick to spot and fix.
What JSON is
JSON stands for JavaScript Object Notation. It is a text format for representing structured data — objects with named fields, lists of items, numbers, text, and true/false values — in a way that is both human-readable and easy for programs to parse. Despite the name it is language-independent; virtually every programming language can read and write it, which is why it became the default way for systems to exchange data over the internet.
A JSON object is wrapped in curly braces and holds key–value pairs: {"name": "Ada", "age": 36, "active": true}. An array is wrapped in square brackets and holds an ordered list: ["red", "green", "blue"]. Values can themselves be objects or arrays, so JSON can describe deeply nested structures.
The rules it enforces
JSON's strictness is the source of both its reliability and its frustration. Keys must be wrapped in double quotes — not single quotes, and not left bare. Text values must also use double quotes. Numbers are written plainly, without quotes. The only permitted values are objects, arrays, strings, numbers, true, false, and null — no dates, no functions, no comments.
Crucially, JSON does not allow a trailing comma after the last item in an object or array. This is the single most common thing that breaks otherwise-valid JSON, because many programming languages do allow it, so the habit carries over.
The errors that trip people up most
Four mistakes account for most JSON failures. First, the trailing comma: {"a": 1, "b": 2,} is invalid — delete that last comma. Second, single quotes: {'name': 'Ada'} must become {"name": "Ada"}. Third, unquoted keys: {name: "Ada"} needs quotes around name. Fourth, mismatched or missing brackets and braces — an opening { or [ without its matching close, which is easy to do in large nested files.
Less common but baffling when they happen: an unescaped double quote inside a string (you need a backslash, like "she said \"hi\""), and "smart quotes" pasted from a word processor, which look like quotes but are different characters JSON does not accept.
How to read a parse error
JSON parsers usually report the line and column where parsing failed — but the real problem is often just before that point. A missing comma, for instance, is only detected when the parser reaches the next token and finds it unexpected. So when an error points at line 12, scan the end of line 11 too. Once you know the four common culprits, most errors take seconds to locate.
Validate and format it instantly
Rather than hunting through a wall of minified text by eye, paste it into QTNest's JSON Validator & Formatter. It pinpoints the exact location of a syntax error in validate mode, and in format mode it pretty-prints valid JSON with your choice of indentation so the structure becomes readable. Everything runs in your browser, so even sensitive payloads with keys or personal data never leave your device.
Related Tools
JSON Validator & Formatter
Validate JSON for errors and format it with custom indentation — all in one tool.
UUID Generator
Generate version 4 UUIDs (Universally Unique Identifiers) instantly. Generate up to 20 at once and copy with one click.
Color Converter
Convert colors between HEX, RGB, and HSL with a live picker and one-click copy.