Technology & Developers
Free JSON Formatter and Validator
Beautify, minify and validate JSON, with real error messages.
Free to useNo sign-up requiredNo watermarkRuns in your browser
This free JSON formatter beautifies unreadable JSON into indented, scannable output, minifies it back down for production, and tells you clearly when it is not valid - with the line and column where the problem is, whenever the browser can supply it.
It is the tool for the moment an API returns one enormous line of JSON and you need to see what is actually in it.
How this tool works
Paste your JSON
Formatted or minified, one line or a thousand.
Choose an output style
Two spaces, four spaces, tabs, or minify to strip all whitespace.
Read the verdict
Valid JSON is confirmed with the resulting size. Invalid JSON gets the parser message and, where available, the line and column.
Copy or download
Take the formatted result, or save it as a .json file.
How it works
The JSON is parsed by your browser's own engine - the same one your application will use - and then re-serialised with the indentation you chose. If it parses here, it will parse in your code.
Minifying removes every unnecessary space and line break. On a large payload that routinely saves twenty to thirty per cent before compression.
Validation is strict JSON, not JavaScript. Trailing commas, single-quoted strings, comments and unquoted keys are all rejected, because they are not valid JSON even though JavaScript would accept some of them.
Error reporting depends on what the browser provides. Some errors come with a character position, which is turned into a line and column; others only give a description and a snippet. Both are shown rather than guessing a location that might be wrong.
The errors that catch people out
- A trailing comma after the last item. Valid in JavaScript, invalid in JSON, and by far the most common cause.
- Single quotes. JSON strings must use double quotes - 'name' is invalid, "name" is fine.
- Unquoted keys. {name: "x"} is a JavaScript object, not JSON. It must be {"name": "x"}.
- Comments. // and /* */ are not part of JSON, however useful they would be in a config file.
- NaN, Infinity and undefined are not JSON values. Use null.
- A stray BOM or invisible character at the start, common when a file has been edited on Windows.
Formatted or minified?
Use indented JSON anywhere a human reads it: config files committed to a repository, fixtures, documentation examples. The diffs are far easier to review, because a change touches one line rather than all of them.
Use minified JSON for anything sent over the wire. It is smaller and no harder for a machine to parse. Most servers gzip responses anyway, which narrows the gap, but the saving is still real on large payloads.
Worked examples
An API response on one line
Paste it, format with two spaces, and the structure becomes readable immediately.
Finding a syntax error
A config file the application refuses to load - paste it here and the parser message usually names the problem straight away.
Shrinking a payload
Minify a formatted fixture before embedding it, and watch the byte count drop.
Frequently asked questions
Is this JSON formatter free?
Yes, free with no sign-up and no limit on the size of the JSON.
Is my data sent to a server?
No. Everything runs in your browser, so whatever you paste never leaves your device. That matters here more than on most tools - people paste API keys, tokens and customer records into encoders and formatters without thinking about it.
Is my JSON uploaded anywhere?
No. It is parsed by your own browser. This is worth caring about - JSON pasted into a formatter very often contains API keys, access tokens or personal data.
Why does it reject my JSON when JavaScript accepts it?
JSON is stricter than JavaScript object syntax. Trailing commas, single quotes, unquoted keys and comments are all valid JavaScript but invalid JSON.
Can it handle very large files?
Yes, within your device's memory. Multi-megabyte payloads work, though the browser may pause briefly while parsing.
Does formatting change my data?
No. Only whitespace changes. Key order is preserved, and values are untouched.
