What "valid JSON" actually means
JSON is specified by RFC 8259, and the grammar is deliberately tiny — six structural characters, four literals, strings, and numbers. That small surface is why it won, and it is also why so much of what people write is almost JSON. This validator uses the browser's native JSON.parse(), so what passes here is exactly what will pass in your runtime, not a looser approximation of it.
Trailing commas
{"a": 1,} is invalid. JavaScript object literals allow a trailing comma and JSON does not, which is why hand-edited config files break after someone deletes the last entry. This is the single most common parse failure, and the first thing Fix removes.
Single quotes
{'a': 1} is invalid. JSON strings must use double quotes, for both keys and values. Output copied from a Python repr() or a JavaScript console almost always needs this fixed.
Unquoted keys
{a: 1} is invalid. Every key is a string and must be quoted. JavaScript permits bare identifiers as keys; JSON never does.
Comments
Neither // nor /* */ is legal JSON. Formats that appear to allow them — tsconfig.json, VS Code settings — are JSON with Comments (JSONC), a different format parsed by a different reader.
NaN and Infinity
Not valid JSON values, despite being valid JavaScript numbers. A serialiser that emits them produces output no conforming parser will read — JSON.stringify converts them to null for exactly this reason.
Leading zeros and +
01, +1 and .5 are all invalid numbers. JSON requires 1, 1 and 0.5. Hex literals such as 0xFF are invalid too.
The precision problem nobody warns you about
JSON numbers have no specified size limit, but JavaScript parses them into IEEE 754 doubles, which hold integers exactly only up to 253 − 1. Beyond that, parsing silently loses precision:
{"id": 9007199254740993} parses to 9007199254740992 — quietly off by one.
- Twitter/X snowflake IDs, Discord IDs and many database bigint primary keys exceed this range routinely.
- No error is raised. The number simply changes, and you find out when a lookup by ID misses.
This is why mature APIs serialise large identifiers as strings. If you control the producer, do the same. If you do not, parse with a library that supports BigInt rather than the native parser. This page scans the raw text for integers beyond that range and warns you above the input — the document is valid; the round trip through a double is what loses information.
Schema validation, briefly
A JSON Schema is a contract: it says which keys must exist, what type each value has, which strings are dates or emails, what a status field may contain. Validating a payload against it before you process it turns a vague runtime failure three functions deep into a precise message at the boundary — $.orders[2].total: expected number, got string. The validator here covers draft-07 and the 2020-12 keywords most schemas use: type, properties, required, additionalProperties, items, enum, const, format, pattern, numeric and length bounds, uniqueItems, local $ref, allOf/anyOf/oneOf/not, and if/then/else.
Inferring a schema from a sample is the fast way to get one. The inference marks a key as required only if every object in the sample has it, types a field as nullable only if a null was actually seen, and proposes an enum only when a string field repeats a small set of values. Treat the result as a draft: it describes the sample you gave it, not every document the producer might emit.
Minify, beautify, and what each is for
Both operations preserve the data exactly and change only the whitespace, but they serve opposite purposes. Beautifying is for reading, reviewing and diffing — a formatted file produces line-level diffs a human can review, whereas a minified one produces a single enormous changed line. Minifying strips every unnecessary byte for transmission and storage.
One caveat worth knowing: neither operation guarantees key order is meaningful. RFC 8259 defines an object as an unordered collection, so while JSON.parse and JSON.stringify happen to preserve insertion order in practice, you should never rely on ordering as data. If order matters, use an array. If you want a canonical form for comparison, enable Sort keys — or send both documents to the diff tool, whose structural mode ignores order entirely.
Why this runs in your browser
API responses are exactly the kind of thing that contains bearer tokens, customer email addresses, internal identifiers and occasionally a password reset link. Pasting that into a server-side formatter means handing it to infrastructure you cannot inspect. Everything here happens in the page: parsing, repair, queries, schema validation, type generation and SQL export are all local JavaScript. The indicator in the header counts network requests the page makes; it stays at zero while you work.