convert

JSON Formatter

Pretty-print and validate a JSON file with 2-space indentation.

Runs on your deviceBatch ready

Add a file

JSON, XML, text or any file you want to encode, decode or hash.

Drop a file here
Drag and drop, or choose files
JSON

Choose an output

Pretty-print and validate a JSON file with 2-space indentation.

About JSON Formatter

This formatter parses a JSON file and writes it back out with 2-space indentation, one key per line. Because the file has to parse before it can be re-printed, it also works as a quick validity check: if the JSON is broken, you get an error instead of output.

When it helps

  • Reading a minified API response or webhook payload you saved to disk.
  • Making a package-lock.json, tsconfig or exported settings file reviewable before committing it.
  • Re-indenting a hand-edited config so a diff shows only the real changes.
  • Inspecting a JSON export from a database or analytics tool that came out as a single line.

Tips

  • The output is standard JSON.stringify formatting, so it matches what most editors and Prettier produce for plain JSON.
  • Comments and trailing commas are not valid JSON and will cause a parse error. Remove them first, or use the JSON Validator to find the exact line.
  • Very large integers beyond 2^53 lose precision when parsed in JavaScript, so IDs like 64-bit Twitter snowflakes may change. Keep such values as strings in the source.

Good to know

Quick answers about json formatter in your browser.

No. Only whitespace changes. Keys keep their original order and values are identical, except for the precision issue with integers larger than 2^53, which affects any JavaScript-based parser.

This tool always uses 2 spaces, the most common convention for JSON. If you need 4 spaces or tabs, the Sort JSON Keys tool has an indent setting, but it also reorders keys alphabetically.

Yes. There is no sign-up, no watermark and no limit on how many files you process.

No. Files are read and processed locally in your browser, so they never leave your device.

Related tools