What is JSON?
JSON (JavaScript Object Notation) is the most widely used data-interchange format for web APIs, configuration files, and document storage. Its design is deliberately minimal: just six value types — object, array, string, number, boolean, and null — combinable with unlimited nesting.
Unlike JavaScript (where it gets its name and syntax from), JSON is a pure data format, not a programming language: it has no functions, no comments, no circular references, and no logic of any kind. That restriction is intentional — the formal specification, RFC 8259, exists precisely so that any parser, in any programming language, interprets the same JSON document in exactly the same way.
Strict rules behind the most common errors
Most JSON syntax errors come from habits that are perfectly valid in JavaScript but explicitly forbidden by the JSON spec:
- Keys always go in double quotes.
{name: "Ana"}is not valid JSON; it has to be{"name": "Ana"}. Single quotes aren't allowed anywhere either, not for keys and not for strings. - Trailing commas are not allowed.
[1, 2, 3,]is an error — the comma after the last element of an array or the last property of an object isn't permitted. - No comments. Neither
//nor/* */. If a config file needs comments, JSON probably isn't the right format for that use case (formats like YAML or JSON5 do allow them, at the cost of giving up JSON's universal portability). - Numbers can't have leading zeros.
01is invalid; it has to be1or1.0. An explicit+sign isn't allowed either — only-for negative numbers. - Strings only accept a specific set of escape sequences:
\",\\,\/,\b,\f,\n,\r,\t, and\uXXXXfor any Unicode character by its 4-digit hex code.
Why JSON.parse()'s error message sometimes isn't helpful
When JSON.parse() fails, the error message it produces varies depending on the JavaScript engine running it — V8 (Chrome, Node.js), JavaScriptCore (Safari), and SpiderMonkey (Firefox) all report the error position differently and with different levels of detail, and none of it is standardized by the JavaScript spec. This tool doesn't rely on those messages: it parses the JSON with its own validator, character by character, so it can always point to the exact line and column where the syntax stops being valid, regardless of which browser is running it.
Formatting vs. minifying
Formatting (or "pretty-printing") adds consistent indentation and line breaks so the document's structure is easy to read at a glance — useful when inspecting an API response or debugging a config file. Minifying does the exact opposite: it strips all non-essential whitespace to shrink the file to its smallest possible size, which matters when the JSON travels over a network or gets stored somewhere with size limits. The actual data — the keys, values, and their structure — is identical either way; only the text representation changes.
How to use this tool
Paste your JSON into the input field. Validation is reactive: if there's a syntax error, it shows up immediately with the exact line, column, and offending character. If the JSON is valid, you can format it with your preferred indentation (2 or 4 spaces) or minify it, and copy the result with one click.