JSON Formatter
Format, validate, and minify JSON instantly.
How to use JSON Formatter
What this tool does
A JSON formatter takes JSON — whether it arrived as one dense, unreadable line or with messy, inconsistent indentation — and rewrites it cleanly. ToolJutsu’s tool does three jobs. Format pretty-prints JSON with the indentation you choose. Minify strips every unnecessary space and line break to produce the smallest valid output. Validate checks whether the text is well-formed JSON and tells you exactly where it breaks if it is not. All three run entirely in your browser, so the JSON you paste is never uploaded anywhere.
Why you might need it
APIs return JSON, configuration files are written in it, and log lines are full of it. Most of the time that JSON arrives hard to read: minified into one endless line, or printed with indentation that fights you. Formatting makes the structure visible — you can see how objects nest, spot a missing or misspelled field, and read a payload at a glance. Minifying does the opposite job: when you embed JSON in a URL, an HTML data attribute, or send it across a network, every byte matters. And validation answers the question that comes up the moment something breaks: “is my JSON actually valid, and if not, where?”
How to use it
- Paste your JSON into the input box — or drop a
.jsonfile straight onto it. - Choose a mode: Format, Minify, or Validate.
- For Format, pick your indentation: 2 spaces, 4 spaces, or tabs.
- Click the action button, or press Ctrl/Cmd + Enter.
- The result appears below with a one-click copy button; Validate shows a clear pass or fail message instead.
The byte counter beneath each box shows how much your JSON weighs before and after — a quick way to see how much minifying actually saves on a large payload.
Common pitfalls
The most frequent reason JSON is reported as “invalid” is something that looks like JSON but is not quite. JSON is stricter than JavaScript object syntax: keys must be wrapped in double quotes, strings cannot use single quotes, there can be no trailing comma after the last item in an array or object, and comments are not allowed at all. A JavaScript object literal copied straight from code will often fail for exactly these reasons. When parsing fails, the tool reports the line and column of the first error — start there and read outward. One more subtle trap: very large integers can lose precision, because JSON numbers are parsed as standard double-precision floating-point values.
Tips and advanced use
Use Validate as a quick gate before pasting JSON into another tool or committing a config file — it is far faster than waiting for a build to fail. When you are comparing two API responses, format both with the same indentation so a line-by-line diff lines up cleanly. If you are shipping JSON inside an HTML attribute or a query string, minify it first; on a large payload the size saving is often significant. And because every operation here is client-side, it is genuinely safe to format JSON that contains access tokens, internal identifiers, or customer data — none of it ever leaves your machine.