JSON Formatter & Validator
Paste JSON to format it instantly, or find exactly which line and column breaks it. API responses and config files often contain tokens or personal data, so nothing you paste is sent to a server — it is processed entirely in your browser.
Enter JSON and the formatted output and validation result appear here.
How to use the JSON formatter
- Paste your JSON. Inputs up to 1 MB update as you type; larger inputs are processed only when you press Run, so the page never freezes.
- Format indents with 2 spaces, 4 spaces or tabs. Minify strips every optional space and line break. Validate only checks syntax without producing output.
- Sort keys A–Z orders object keys by Unicode code point — handy before diffing two documents.
- Copy the result or download it as a
.jsonfile.
Numbers and strings are copied exactly as written; only whitespace changes. Unlike tools built on JSON.parse, a 64-bit ID such as 12345678901234567890 or a price like 1.50 comes out unchanged.
Got a JWT payload or other Base64-encoded JSON? Decode it first with the Base64 decoder (URL-safe supported).
Common JSON syntax errors
JSON (RFC 8259) looks like JavaScript but is much stricter. When the validator points at a position, check these first.
| Invalid | Valid | Rule |
|---|---|---|
{"a": 1,} | {"a": 1} | No trailing commas |
{'a': 'b'} | {"a": "b"} | Double quotes only |
{a: 1} | {"a": 1} | Keys must be quoted |
// note | (remove) | No comments |
{"zip": 02134} | {"zip": "02134"} | No leading zeros; store ZIP codes as strings |
NaN, undefined | null | Not JSON values |
True, None | true, null | Python literals must become lowercase JSON |
Lines and columns start at 1 and count UTF-16 code units, matching the "Ln, Col" display in editors such as VS Code (an emoji counts as 2 columns).
When to format, minify or sort
- Pretty print one-line API responses and logs so humans can read them, or before pasting into a code review or docs.
- Minify to fit a config into a single environment variable or to shave bytes off a payload. Only whitespace is removed; the data is identical.
- Duplicate keys are technically allowed but most parsers keep only the last one, so the validator warns about them.
Need unique IDs for test fixtures? Generate them in bulk with the UUID generator. Tabular data can go between spreadsheets and text with the Excel to CSV converter.
FAQ
Is my JSON uploaded to a server?
No. Formatting, minifying and validation all happen in your browser. Nothing is sent to a server or stored, so responses containing API keys or customer data are safe to paste. Once the page has loaded it even works offline.
How large a file can it handle?
As much as your device's memory allows — tens of megabytes on a laptop take a few seconds. Above 1 MB the tool waits for the Run button instead of reprocessing on every keystroke.
Does it support JSON Lines (NDJSON)?
Not directly: JSON Lines is several JSON values in a row, which the validator reports as "content after the end of the JSON value". Validate one line at a time, or wrap the lines in [ ] with commas to make an array.
Sources
Found this useful? Share it
Only the page link is shared. Your inputs and files are never included.