JSON Formatter

🔒 Processed 100% in your browser — nothing is uploaded

About this tool

JSON arrives in every shape: minified API responses with no whitespace, config files with inconsistent indentation, payloads copied out of log lines. JSON Formatter tidies all of them in one click. Paste any JSON document and pretty-print it with 2-space or 4-space indentation, or compress it to a single minified line for embedding in code, URLs or environment variables. A dedicated Validate button checks syntax without reformatting, and when the document is invalid the tool reports the exact line and column of the parser error and shows the offending line with a caret under the problem character — no more hunting for a missing comma in a ten-thousand-line file. An optional key-sorting mode reorders every object's keys alphabetically, which is invaluable for diffing two versions of a config file or producing deterministic output for snapshots and golden tests. The result can be copied to the clipboard or downloaded as a .json file. Everything runs locally in your browser on top of the native JSON parser, so secrets, tokens and customer data never leave your machine. Pair it with a schema validator or a diff tool and you have a complete JSON inspection workflow, entirely offline.

How to use JSON Formatter

  1. Paste your JSON into the input area, or press Load sample to see the expected format.
  2. Choose the indentation (2 or 4 spaces) and optionally enable key sorting.
  3. Press Format to pretty-print, Minify for a single line, or Validate to check syntax only.
  4. Copy the output or download it as a .json file. If validation fails, fix the line and column shown in the error.

Frequently asked questions

How are syntax errors reported?

The tool shows the exact line and column where the native JSON parser stopped, and prints the offending line with a caret pointing at the problem character, so you can jump straight to the missing comma or quote.

What does key sorting do?

It reorders the keys of every object in the document alphabetically (recursively, including nested objects). Array order and all values are preserved. It is ideal for comparing two JSON files or generating stable output for tests.

Is my data uploaded anywhere?

No. Formatting, validation and minification run entirely in your browser using JavaScript's built-in JSON parser. Nothing is transmitted, logged or stored.

My JSON will not parse at all — what now?

If the input came from an LLM and has trailing commas, single quotes or markdown fences, run it through our LLM JSON Repair tool first, then format the result here.