JSON Formatter

–status
–size
–keys + values
–max depth
TypeSyntaxRules
object{"key": value}Unordered name/value pairs - names are always strings in double quotes
array[value, value]Ordered values - mixed types allowed
string"text"Escapes: \b \f \n \r \t and \uXXXX forms - nothing else is legal
number-12.5e+3Decimal only: no leading zeros, no hex, no NaN or Infinity
true / falsebooleanLowercase only - True and FALSE are errors
nullnullAbsence of a value - distinct from the empty string
The complete grammar, per RFC 8259: six value types, nothing more. The three parsing killers in the wild are trailing commas, comments and single-quoted strings - all legal in dialects like JSON5 or JSONC, all illegal in real JSON, and all invisible until a parser rejects them. A file that starts with the invisible BOM (U+FEFF) also fails strict parsers - strip it first.

  
Everything runs locally in your browser - API keys and payloads never leave this page.

Half of all JSON errors are the same three culprits: a trailing comma after the last item, single quotes standing in for double, and an unquoted key. Paste any JSON here and the formatter validates it with the browser's native parser, pretty-prints it at your chosen indent, and when something is wrong it names the character position and the likely offender instead of just saying 'unexpected token'.

The stats line sizes the payload (bytes, keys plus values, nesting depth) - handy for spotting the 200 KB config that grew quietly. Minify collapses it back for transport. Everything runs locally in your browser: API responses with tokens, customer data, draft payloads - none of it leaves the page, which is exactly why a local formatter beats a random web one.

How to use

  1. Paste your JSON - validation and pretty print happen instantly.
  2. Pick 2-space, 4-space or tab indent; Minify collapses for transport.
  3. Fix errors by their reported position, then copy or re-check.

Frequently asked questions

Is my JSON uploaded anywhere?

No - parsing and formatting use the browser's own JSON engine on this page, with zero network calls. That matters for API responses and config files containing tokens; a local formatter is the one that cannot leak them.

Why is my JSON invalid with a trailing comma?

Strict JSON forbids a comma after the final element - {"a":1,} fails. The error usually points just past the real spot. JavaScript objects allow it, which is why code pasted into a JSON context breaks; remove the last comma and it parses.

What's the difference between JSON and a JavaScript object?

JSON is a text format: keys must be double-quoted, no comments, no single quotes, no undefined, and numbers have rules. A JS object literal is looser on all of those. Formatting here validates against strict JSON, so it catches the looseness a browser would silently accept in code.

Does it handle large files?

Comfortably into the megabytes on a normal machine - the limit is your browser's textarea, not a server. For very large payloads the stats line (bytes, node count, depth) gives you the shape before you expand it.

Why does my JSON fail even though it looks valid?

Three dialect features cause almost all of these: trailing commas (allowed in JavaScript object literals, forbidden in JSON), comments (allowed in JSONC config files, forbidden in JSON), and single-quoted strings (legal in JSON5, illegal in JSON). Copy-pasted config files are the usual source - VS Code settings and tsconfig use JSONC, and a JSON parser rejects them on principle. One more silent killer: a file downloaded or exported from Excel sometimes starts with the invisible byte-order mark U+FEFF, which strict parsers read as an illegal first character even though you cannot see it. The formatter above pinpoints the exact character offset of the failure - trust that number over your eyes.

Related tools