Our JSON formatter formats, validates, minifies and sorts keys.

It processes your input in the browser and reports syntax errors without uploading the document. Here is what each operation does and what to check before copying its output.

Why we built it

The same reason as the UUID generator.

You should not have to upload a document to format it.

The last one matters more for JSON than for UUIDs, because the JSON you format is usually real data: an API response with customer records, a config file with connection strings, a webhook payload with an order in it.

Pasting that into a stranger's server to add some line breaks is a bad trade.

So the formatter runs entirely in the page.

After parsing succeeds, it checks the source for duplicate names and numbers that JavaScript changes.

Formatting, minifying and sorting serialize the parsed value. They can keep only the last duplicate value, round numbers or write an overflowed number as null.

Read any warning before copying output. Validation leaves the input text untouched, but it also reports these warnings.

There is no upload, no history on our side, nothing to delete later.

The four jobs

Format. Takes a minified blob and pretty prints it with the indent you choose: two spaces, four spaces or tabs. Servers strip whitespace to save bandwidth, and formatting puts the structure back so you can see where a field lives.

Validate. Checks syntax without changing the text and displays the parser's error message. More on the error messages below.

Minify. Parses the input and writes compact JSON without layout whitespace. Check warnings before copying, because parsing and serialization can change duplicate names or numbers. Byte and token savings depend on the document and tokenizer.

Sort keys. Recursively sorts non-index object keys alphabetically. Keys such as "2" and "10" follow JavaScript's property order and appear in numeric order first. Sort both documents before comparing them in your editor.

Three smaller conveniences: Load Sample drops in a realistic document so you can try the buttons, Clear resets both boxes, and Copy Output grabs the result.

Error messages that point at the problem

When the browser reports a character position, the formatter converts it to a line and column.

For an unexpected end of input, it reports the line and column at the end of your text.

If the browser already supplies a line and column, the formatter keeps that message. Other errors keep the browser's original message without an invented location.

Examples it catches include a trailing comma after the last item, single quotes instead of double, an unquoted key, a comment, a raw line break inside a string.

Our guide to JSON syntax rules and ten JSON syntax errors explains each one and how to fix it.

Habits it supports

Debugging an API. Paste the raw response, click Format, read it. If a server returns HTML instead of JSON, inspect the error message and any location the parser provides.

Comparing two configs. Sort Keys on both, then diff them in your editor. Differences that were hidden by key order disappear.

Shrinking JSON before it goes somewhere. Minify before storing a document in a column, before committing a fixture, or before pasting it into an AI prompt. Our post on reducing token usage explains why whitespace costs money.

Learning JSON. The guide under the tool covers the six value types, why formatting matters, the difference between JSON and a JavaScript object, and how the tool itself works.

Limits, honestly

It is a text tool.

Formatting runs on the browser's main thread, so a large input can make the page less responsive. It does not show you the shape of the document.

That job belongs to the JSON visualizer, which draws the structure as a diagram you can pan and zoom and export as Mermaid text.

The formatter also does not repair JSON. When it says line 12 column 8, fixing that is up to you, which is the right division of labour for a tool that touches production data.

Need an option the formatter does not have?

Say so on the contact page.

Describe what the input looks like and what you want out, and include a small example if you can. Specific requests are the easiest to act on.