JSON Formatter & Validator

Runs entirely in your browser
Input JSON
0 chars0 lines
T
ALL TOOLS · THE CATALOG
34 single-purpose utilities · runs local
Browse all →
All tools process files entirely in your browser · Your data never leaves your device

JSON Formatter — Free Online Pretty-Print, Minify & Diff

Format and validate JSON instantly. Pretty-print with 2/4/tab indent, minify for transmission, or diff two JSON blobs side-by-side. Everything runs in your browser — your data stays local.

How to format and validate JSON online

  1. Paste your JSON. Paste raw JSON into the left editor, or drag a .json file into the editor area. Up to 10 MB works smoothly.
  2. Pick indent style. Choose 2 spaces, 4 spaces, or tab indentation. The formatted output appears live in the right pane.
  3. Validate. Invalid JSON shows the exact line and column of the error in red, with a one-line explanation of what went wrong.
  4. Copy, minify, or diff. Copy formatted output, switch to minify mode (single-line output for transmission), or load a second blob into the diff view.

Frequently Asked Questions

Is my JSON uploaded or logged?
No. Formatting, validation, and diff run entirely in your browser. Nothing is sent to a server.
What is the maximum file size?
Up to ~10 MB performs smoothly. Larger files may slow the editor. For >50 MB consider a CLI tool like jq.
Does it sort keys alphabetically?
Yes — toggle the "Sort keys" option to alphabetize object keys recursively. Useful for stable diffs.
Can it handle JSON5 or JSONC (with comments)?
Yes — toggle the "Allow comments" option. Output is valid JSON (comments stripped).
How does the diff view work?
Load JSON A and JSON B. Differences are highlighted line-by-line. Added keys appear green, removed red, changed yellow.
Will it preserve number precision?
JavaScript number precision (53-bit) is preserved. For larger integers (BigInt), use a CLI tool.

Use Cases

The 6 JSON syntax errors that trip people up most

JSON looks like a JavaScript object literal but follows a stricter grammar (RFC 8259) — most "invalid JSON" reports are one of a handful of repeat offenders, usually from copy-pasting JS code or a trailing comma left over from editing.

ErrorInvalid exampleWhy it failsFix
Trailing comma{"a": 1, "b": 2,}JSON has no trailing commas, unlike modern JSRemove the comma before } or ]
Single quotes{'a': 1}JSON strings and keys must use double quotes onlyUse "a" not 'a'
Unquoted keys{a: 1}JS object shorthand is not valid JSONQuote every key: {"a": 1}
Comments{"a": 1 /* note */}JSON has no comment syntax at allDelete comments, or use the JSON5/JSONC mode below
NaN / undefined / Infinity{"a": NaN}These are JS values with no JSON equivalentUse null, or a sentinel string like "NaN"
Leading zeros{"a": 007}Numbers cannot have leading zerosWrite 7, or quote it as a string "007"