JSON Formatter — Free Online Pretty-Print & Minify

Runs entirely in your browser
Input JSON
0 chars0 lines
T
ALL TOOLS · THE CATALOG
477 single-purpose tools · no sign-up
File-processing tools run in your browser. Network and device requirements are described on each tool.

Format and validate JSON instantly. Pretty-print with 2/4/tab indent or minify to a single line, with color-coded syntax highlighting. Everything runs in your browser — your data stays local.

FreeNo sign-upRuns in your browser

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 — JSON has no equivalent
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"
  • JSON5 and JSONC (JSON with Comments, used by VS Code's settings.json and tsconfig.json) relax several of these rules — trailing commas and comments are allowed — but this tool validates against strict JSON (RFC 8259), so JSONC files need comments stripped before pasting them in.

How to format and validate JSON online

  1. Paste your JSON. Paste raw JSON into the editor, or drag a .json file into the drop zone / click Upload File.
  2. Pick indent style. Choose 2 spaces, 4 spaces, or tab indentation for the Format / Prettify output.
  3. Format or minify. Click Format / Prettify for a readable, syntax-highlighted, indented view, or Minify for a single-line output ready for transmission.
  4. Copy or clear. Invalid JSON shows the exact parser error message in red. Copy the formatted output with one click, or Clear to start over.

Frequently Asked Questions

Is my JSON uploaded or logged?
No. Formatting and minifying 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 the output have syntax highlighting?
Yes. Formatted and minified output color-codes strings, numbers, booleans, null, and object keys so structure is easy to scan.
What happens if my JSON is invalid?
The tool shows the parser's exact error message so you can find and fix the problem quickly.
Can I upload a file instead of pasting?
Yes. Click Upload File or drag a .json/.txt file directly into the input area — its contents load into the editor.
Will it preserve number precision?
JavaScript number precision (53-bit) is preserved. For larger integers (BigInt), use a CLI tool.

Use Cases

  • Debug API responses by pretty-printing raw JSON
  • Minify JSON config before embedding in HTML or environment variables
  • Spot-check a config file's structure with color-coded syntax highlighting
  • Validate JSON syntax before pasting into a config file
  • Upload a .json file straight from disk instead of copy-pasting