json formatter

How to use the json formatter

  1. Paste raw or minified JSON into the input box on the left.
  2. The validator parses on every keystroke. A red error message points to the exact line and character if the JSON is malformed.
  3. Pick indent: 2 spaces, 4 spaces, or tabs. The output formats live as you type.
  4. Switch to 'Minify' mode to compress JSON for transport (strips all whitespace).
  5. Use the tree view to navigate large nested structures, or copy the formatted output to your clipboard.

When to use it

Use it whenever you paste a JSON response from DevTools, an API tool, or a log file and need to read it. The line-numbered error reporting makes it the fastest way to diagnose syntax issues — missing commas, unclosed strings, trailing commas. Alternative: most code editors format JSON with one keystroke; this tool wins when you're in a browser tab and don't want to switch contexts.

Frequently asked questions

Why is my JSON invalid?
The most common causes: trailing commas (not allowed in strict JSON), single quotes instead of double, unquoted property names, or unescaped backslashes/newlines inside strings. The error message includes the line and column of the failure.
Does the JSON formatter support JSONC (JSON with comments)?
Standard JSON does not allow comments. We strictly validate against the JSON spec. For JSONC files (VS Code settings, tsconfig.json), strip comments first or use a JSONC-aware parser.
Can I format JSON Lines (newline-delimited JSON)?
JSON Lines is a sequence of independent objects, one per line. Format each line individually — pasting all of them at once will fail validation.
How do I sort JSON keys alphabetically?
Toggle 'Sort keys' in the sidebar. The formatted output emits properties in alphabetical order at every nesting level. Useful for diffing config files.
What's the maximum JSON size?
The browser parser handles 50 MB+ documents on desktop. Beyond that, the formatter UI may slow down — for huge log files, use a streaming JSON parser instead (`jq`, `dasel`).
Can I convert JSON to YAML or CSV?
Yes — see our dedicated JSON to YAML and CSV to JSON converters for round-trip workflows.

Related tools

Last updated: 2026-04-27