Home › Developer tools › Format JSON
Developer tool

Format and validate JSON — free, private, in your browser

Check JSON for syntax errors, see the exact line and column of a mistake, and pretty-print it with the indentation you prefer. Parsing happens locally, so API responses and config files carrying real data never leave your machine.

Perfect for
An API response you have to read A config file that stopped working A .json file a colleague sent over Checking a webhook payload Pasting a payload into a bug report
How to use it
1
Paste your JSONDrop it into the box, or load the sample to see how the tool behaves.
2
Read the verdictValid JSON is confirmed at once, with the key count and nesting depth. A mistake is reported as a line and column.
3
Format or minifyFormat pretty-prints with your chosen indentation. Minify removes every optional space for the smallest possible payload.
4
Copy the resultOne click copies the whole output, ready to paste back into your editor.

Options

Useful when comparing two documents line by line. Key order carries no meaning in JSON, so sorting is safe.

Tip: the error message points to a line and column, so you can jump straight to the typo instead of hunting for it.

Not sure what to paste? .


        

Why a JSON file that “looks fine” usually is not

JSON borrows its looks from JavaScript object literals and almost none of their leniency. That resemblance is the entire cause of the problem: everything you habitually do when writing a JavaScript object is illegal in a JSON document, and the parser stops at the first one it meets.

The most common single causeA trailing comma after the last property. It is legal in JavaScript, in Python and in most modern languages — and in JSON it invalidates the entire document.

The four mistakes behind most JSON errors

Message you seeWhat it meansFix
Unexpected token }A trailing comma before a closing brace or bracketDelete the comma
Unexpected token 'Single quotes used for a string or a keyJSON requires double quotes for both
Unexpected token n or uAn unquoted key, or the literals NaN / undefinedQuote the key; neither literal exists in JSON
Unexpected end of JSON inputA missing closing brace, bracket or quoteBalance the pairs

Format or minify — which do you actually want?

They are the same operation with different whitespace, and choosing wrongly is a common source of confusion. Formatting inserts line breaks and indentation so a person can see the shape of the document; the payload grows by the size of that whitespace. Minifying removes every optional space and newline, which is what you want for a request body, a stored configuration value or anything being counted in bytes. Neither one changes a value, a key or a type — the parsed data is identical.

What this tool deliberately does not do

  • It does not accept comments, trailing commas or unquoted keys. The browser's own strict parser is the point: if this page says your JSON is valid, a build script, an API gateway and a mobile client will agree.
  • It does not silently repair broken JSON. A tool that guesses at your intent can change the meaning of the data, which is far worse than a clear error message.
  • It does not upload anything. There is therefore no server-side size limit, but also no server-side memory to fall back on — the ceiling is your own device.
Worth knowing: the parser reports the position of the first error only. Fix that one and re-run — JSON is parsed front to back, so a single trailing comma can hide a second mistake further down the document.

Frequently asked questions

Is this JSON formatter free?
Yes. There is no sign-up, no daily limit and no watermark. The site is paid for by display advertising, which is why nothing sits behind a paywall.
Is my JSON uploaded to a server?
No. The text you paste is parsed by the browser itself using its built-in JSON parser. Nothing is transmitted, which matters when a document contains API keys, customer records or internal endpoints.
Why does my JSON fail to validate?
In order of frequency: a trailing comma before a closing brace, single quotes instead of double quotes, an unquoted key, or a missing bracket. JavaScript object literals allow all of these; JSON allows none of them.
What is the difference between formatting and minifying?
Formatting adds line breaks and indentation so a human can read the structure. Minifying removes every optional space and newline so the payload is as small as possible. The data is identical either way.
Does sorting keys change my data?
No. A JSON object is unordered by definition, so the same document with its keys sorted is an equivalent document. Sorting is useful when you want to compare two versions line by line.
Can I format very large JSON files?
Yes, up to the memory of your own device. Because parsing is local there is no upload limit and no server timeout, but a file of tens of megabytes will render more slowly in a browser than in a desktop editor.