Paste JSON to beautify, validate and minify it. Errors are pinpointed by line and column. Everything runs in your browser.
Formatted, colour-highlighted JSON appears here.
What this tool does & JSON tips (FAQ)
Beautify, validate and minify JSON when debugging APIs, configs or exported app data — without pasting secrets into a third-party site you do not control.l.
Developers reading an API response that arrived as one unbroken line, anyone handed a config file that will not load, and people who have exported their data from an app and want to see what is actually in it. The common thread is that the JSON in question is often not yours to leak — an API response carries tokens, a config carries credentials, an export carries personal data. That is the reason this runs in the browser rather than on a server.
Example 1 — finding the error in a long file. Paste a config that will not load and press Beautify. Instead of "unexpected token", you get the line and column of the first character that broke parsing, along with what was expected there. On a 400-line file that is the difference between a five-second fix and a bisect.
Example 2 — comparing two API responses. Objects in JSON have no guaranteed key order, so two responses carrying identical data can look completely different in a diff. Run Sort keys on both, then diff them. Only the real differences survive.
Example 3 — checking what minifying actually saves. Beautify a payload and note the output size in the status line, then Minify and compare. On deeply nested data the saving is large; on a flat array of numbers it is close to nothing — worth knowing before you make your API responses unreadable for a gain you did not measure.
Most "invalid JSON" is valid JavaScript that was never JSON. The format does not allow comments, trailing commas, single-quoted strings, unquoted keys, hexadecimal or leading-zero numbers, NaN, Infinity, or undefined. If you copied an object out of source code, all of those are legal where you found it and none of them are legal here.
Strings are strict too: a literal newline inside a string is invalid — it must be written as \n — and the only valid escapes are \" \\ \/ \b \f \n \r \t and \u followed by exactly four hexadecimal digits. A lone backslash from a Windows file path is the single most common cause of an "invalid escape" error.
Browsers used to report the position of a JSON syntax error in the exception message. Current versions of V8 — the engine in Chrome and Edge — no longer do, so "Unexpected token" arrives with no indication of where. This tool therefore runs its own scanner over your input purely to locate the first fault, and reports it as a line and column with a description of what was expected: an unterminated string, an invalid escape, a digit expected after a decimal point, a malformed exponent.
The scanner only finds the first error. Fix it and run Beautify again — a missing bracket early on often masks everything after it.
A trailing comma. {"a":1,} and [1,2,] are both invalid. Most languages accept them; JSON never has.
Single quotes. {'a':1} is not JSON. Keys and strings both require double quotes.
Windows paths. "C:\Users\doug" fails because \U and \d are not valid escapes. It has to be "C:\\Users\\doug".
Pasting a fragment. A document must be one complete value. Half an object copied out of a log will not parse no matter how well formed the visible part looks.
Expecting duplicate keys to be caught. {"a":1,"a":2} is technically valid and the last value silently wins, so a duplicate key survives beautifying and disappears from the output without warning.
Sort keys before diffing. It is the fastest way to compare two structurally identical payloads that a text diff insists are different.
Beautify before reading, minify before sending. Indentation is for humans; it costs bytes on the wire and nothing else.
Do not minify for compression's sake alone. Gzip and Brotli, which almost every server applies already, compress repeated whitespace to nearly nothing. Minifying on top of that usually saves less than you would guess.
Use Sample to test. If you only want to see how the tool behaves, load the sample rather than pasting something confidential.
The input and output are ordinary textareas, so they work with a screen reader, with browser zoom, and with your own font settings. All seven actions are real buttons reachable by Tab. Validation results appear in a status area as text rather than as colour alone, so "valid" and the error location are both announced rather than signalled only by a green or red highlight. Dark mode is available from the theme toggle.
Everything happens in your browser. Parsing, formatting, minifying and sorting are all done by JavaScript on your own device, and the page has no upload endpoint — your JSON is never transmitted to us, never written to a log, and never stored. Copy and Download both read from the result already in the page.
This matters more here than on most tools. API responses routinely contain bearer tokens and session identifiers, configuration files contain database passwords, and app exports contain personal data. Pasting any of that into a server-side formatter hands it to whoever runs that server. Here there is nothing to hand over.
Advertising cookies and your choices about them are described in our Privacy Policy and the consent notice shown on your first visit.
If you are checking the size of a payload rather than its structure, the Word Counter gives character counts on arbitrary text. Colour values pulled out of a theme or config file convert between hex, RGB and HSL in the Colour Picker. Unix timestamps in an API response are durations you can convert in the Unit Converter, and the World Timezones tool turns them into wall-clock times. The full set is on the home page.
Almost always one of five things: a trailing comma before a closing bracket, single quotes instead of double, unquoted keys, a comment, or an unescaped backslash in a Windows file path. All five are legal JavaScript and none are legal JSON. The error message gives you the line and column of the first one.
No. Parsing and formatting run in your browser and the page has no upload endpoint, so nothing you paste is transmitted, logged or stored. That is deliberate — API responses and config files routinely contain tokens and passwords, and a server-side formatter would receive all of them.
No. It expects one complete JSON value. A file with one object per line will parse the first line and then fail, because the second object is unexpected trailing content. Split the lines and check them individually, or wrap the whole thing in brackets and add commas to make it a single array.
JavaScript parses every JSON number as a double-precision float, which represents integers exactly only up to 253 — about 9.007 quadrillion. A 64-bit identifier above that is rounded on parse, and the rounded value is what gets written back out. This affects all JavaScript JSON tooling. If you control the API, send large IDs as strings.
No. The JSON specification defines objects as unordered collections, so {"a":1,"b":2} and {"b":2,"a":1} carry identical data and any conforming parser treats them the same. Sorting is a display and comparison aid. Array order is meaningful and is never changed.
The last one wins and the earlier ones vanish, with no warning. {"a":1,"a":2} beautifies to an object containing only "a": 2. That is standard parser behaviour rather than a quirk of this tool, but it does mean beautifying can silently discard data if your source genuinely had duplicates.
It depends on the shape of your data and on whether the response is already compressed. Deeply nested documents are mostly indentation, so minifying helps. Flat arrays of numbers are mostly content, so it barely moves. Since nearly every server already applies gzip or Brotli — which handle repeated whitespace extremely well — measure the difference before trading readability for it.
Yes, once the page has loaded. All parsing and formatting is local, so it keeps working with the network disconnected. The page itself has to be fetched first, and it is not installable as an offline app.
More help: JSON Formatter FAQ · All tools · Contact · About