Skip to main content
FileForge

JSON Formatter

Paste minified or messy JSON and get a cleanly indented, readable version. Invalid JSON produces an error with the line and position of the problem.

Runs in your browser — files never leave your device

Free · No sign-upOutputs JSON
Loading tool…

How to use JSON Formatter

  1. Paste JSON into the input panel.

  2. Choose 2-space or 4-space indentation.

  3. Click Format — or fix the reported error if the input is invalid.

  4. Copy the formatted output.

About this tool

APIs return JSON on a single line; humans read it indented. This formatter parses your input with the browser's native JSON engine — the same strict parser your code will use — and re-serializes it with your chosen indentation. Because parsing is strict, formatting doubles as validation: trailing commas, single quotes and unquoted keys are reported with their location instead of being silently accepted. Your data stays in the browser, which matters when the JSON contains tokens or customer data.

This is one of the most common everyday debugging steps — pasting in a raw API response, a log line, or a config blob to actually read its structure, rather than squinting at a single unbroken line of text.

Common ways people use this

  • Making an API response readable while debugging an integration
  • Cleaning up a minified config file before editing it by hand
  • Quickly checking the structure of a JSON payload pasted from logs or a support ticket

Tips for better results

  • Use 2-space indentation for a compact, scannable view; switch to 4 spaces if you find deeply nested structures easier to follow with more visual separation.
  • If formatting fails, the error location doubles as a quick syntax check — fix that one spot and try again rather than re-reading the whole document.

Frequently asked questions

Why does my JSON fail with a trailing comma?
The JSON specification forbids trailing commas, even though JavaScript allows them. The error message points at the comma so you can remove it.
Does formatting change my data?
No — only whitespace changes. Keys, values and their order are preserved exactly, including large integer IDs (like database or Twitter/Discord snowflake IDs), which are kept exact rather than rounded the way a plain JSON.parse would.
Is it safe to paste API responses with tokens in them?
Formatting happens entirely in your browser; nothing is transmitted. Still, avoid sharing formatted output that contains live credentials.
Can I format very large JSON documents?
Yes, there's no artificial size limit — practical limits depend on your browser's available memory rather than a server-imposed cap.
What's the difference between this and the JSON Validator?
This tool both validates and reformats valid JSON into a readable layout. The JSON Validator focuses purely on checking correctness and explaining any errors, without changing the output.