JSON Formatter & Validator
JSONFormat, validate and minify JSON. Precise error location with row and column, plus syntax highlighting.
Remote URLs are not fetched; paste your JSON directly.
On this page
What is a JSON formatter?#
A JSON formatter takes a dense wall of JSON — the kind a server logs on a single line, or the kind a bundler emits minified — and rewrites it with consistent indentation so a human can read it. That sounds trivial, but a formatter is usually the first tool you reach for when a request fails, a config file has a typo, or two payloads look identical but behave differently.
This page does three related jobs in one place. It pretty-prints (adds indentation and line breaks), it validates (tells you whether the text is legal JSON at all), and it minifies (strips every byte of whitespace for the smallest possible payload). When validation fails, the status bar does not just say “error” — it reports the exact row and column, which is often the difference between a five-second fix and twenty minutes of staring.
How to use it#
- Paste your JSON into the Input pane on the left. You can also click Sample to load a small example if you just want to see the behaviour.
- Pick an Indent style on the toolbar: 2 spaces, 4 spaces, or a tab. Two spaces is the most common convention; tabs are handy if you are about to paste into an editor that already uses them.
- Choose what else you want done:
- Format — pretty-print with your chosen indent.
- Minify — collapse to a single line, no spaces. Ideal before you paste into a request body.
- Validate — check syntax without changing the text; useful when you only want a yes/no answer.
- Tick Sort keys if you want object properties emitted in alphabetical order. This is surprisingly useful when diffing two responses from different versions of an API: with sorted keys, the only differences left are the ones that actually matter.
- Tick Trailing comma for a relaxed, human-friendly variant (a comma after the last item). Note that strict parsers will reject this — turn it on only for local reading.
- Read the result in the Output pane. The status bar underneath reports either
Valid JSONor the precise error location (row:col — message). Use Copy to grab the output.
Key features#
- Strict native parser. Built on the browser’s own
JSONimplementation, so what passes here is what passes at runtime. No custom dialect, no surprises. - Precise error location. A trailing comma, an unquoted key, a missing bracket — each is reported with its row and column, not just a generic “parse error”.
- Three indentation styles. 2 spaces, 4 spaces, tabs.
- Optional key sorting and trailing comma. Toggle either per job without re-pasting.
- 100% client-side. The text you paste is processed by the page in your browser. It is never uploaded — there is no backend to upload to.
- Live character counts. Both panes show their size, which helps when you are trying to shave bytes off a payload.
Worked example#
Imagine a config endpoint returns this minified blob and you need to spot a misnamed key:
Input (minified, one line):
{"server":"api.example.com","port":443,"retry":{"count":3,"backoffMs":[100,400,1600]},"tags":["prod","primary"]}
Click Format with 2 spaces indent and Sort keys on:
{
"port": 443,
"retry": {
"backoffMs": [
100,
400,
1600
],
"count": 3
},
"server": "api.example.com",
"tags": [
"prod",
"primary"
]
}
With the keys sorted, backoffMs sits next to count, and you can immediately see the exponential shape (100, 400, 1600) that was invisible on the single-line version. Notice that tags is still ["prod","primary"] — Sort keys reorders object properties only; it never touches array elements, so the order you put them in is exactly the order you get back.
FAQ#
Does this upload my data?#
No. Parsing is done by the browser’s built-in JSON API inside this page. There is no server endpoint and no network request — your input stays on your device.
The status bar says my JSON is invalid but it looks fine. What now?#
Check the reported row and column. The four most common culprits are: a trailing comma before a closing } or ], single quotes around strings (JSON requires double quotes), an unquoted object key, and a literal tab or control character pasted from another editor. The column number points at the exact offender.
What does “Sort keys” actually do?#
It re-emits every object’s properties in alphabetical order (ASCII order, case-sensitive). Arrays are left in their original order — sorting keys never reorders array elements, because array order is semantically meaningful.
Can it handle very large files?#
Yes, up to the browser’s memory limit. For files past a few megabytes, expect formatting to take a noticeable moment; the status bar shows the character count so you can gauge size. This page does not stream, so extremely large inputs (hundreds of MB) will strain the tab.