JSON Formatter
Format, validate and minify JSON in your browser — with error positions.
How to use json formatter
- Paste your JSON into the input box.
- Choose an indentation (2 spaces, 4 spaces or tabs) and whether to sort object keys.
- Click Format to pretty-print, Validate to check syntax, or Minify to compress.
- If the JSON is invalid, the error message shows the line and column to fix.
- Copy the formatted output with the Copy button.
Examples
Format a minified API response
A one-line API response becomes a readable, indented structure.
Catch a syntax error
A trailing comma after the last property is one of the most common JSON mistakes — the validator points right at it.
Minify before sending
Strip whitespace from a config file to reduce its size before shipping it. The Try it button loads the JSON and clicks Minify for you.
What is JSON?
JSON (JavaScript Object Notation) is the de facto data format of the web: APIs, config files, NoSQL databases and build tools all speak it. Raw JSON is often served minified — one unreadable line thousands of characters long — which is where a formatter comes in. This tool re-indents JSON so its structure becomes visible, turning debugging from squinting into reading.
Unlike many online formatters, this one never sends your JSON to a server. Pasted payloads often contain real user data, API keys or internal field names, and uploading them to a random website is a genuine security risk. Here, parsing and formatting happen entirely in your browser’s JavaScript engine, so you can safely format production responses and private config files.
The validator doubles as a debugging assistant: when your JSON is invalid, it reports the syntax error with a line and column position so you can jump straight to the problem instead of hunting for the stray comma. You can also minify JSON for production, or sort object keys alphabetically to get stable diffs between config revisions.
Use it when an API response 400s for a malformed body, when a config file gained a trailing comma, or when you simply want a clean, indented snapshot of nested data.
Frequently asked questions
Is my JSON uploaded to a server?
No. Parsing, formatting and validation all run in your browser using the built-in JSON engine. You can disconnect from the internet after the page loads and everything still works.
What indentation options are supported?
Two spaces, four spaces or a tab character per level — pick whichever matches your project’s style guide.
Why does my JSON fail with "Unexpected token"?
JSON is stricter than JavaScript: no trailing commas, no comments, and keys and strings must use double quotes. The error message includes a line and column to help you find the offending character.
What does "Sort keys" do?
It re-orders the properties of every object alphabetically (arrays keep their order). This is useful for comparing two JSON files, because identical data then produces identical text.
Is there a size limit?
There is no hard limit; very large documents (tens of megabytes) may be slow because formatting runs on your device, but nothing is transmitted anywhere.