The Free Online JSON Formatter, Validator, and Auto-Fix Tool
The Intelligent JSON Formatter is a free, fast, and private JSON formatter, validator, and beautifier that runs entirely inside your browser. It pretty-prints JSON with one of three indent styles (2 spaces, 4 spaces, or tab), highlights syntax errors with the exact line and column, and includes an intelligent auto-fix engine that repairs more than twenty common kinds of broken JSON in a single click.
Features
- Format and beautify JSON with custom indentation — 2 spaces, 4 spaces, or tab.
- Validate JSON against the JSON specification with precise line/column error reporting.
- Auto-fix broken JSON — repairs unquoted keys, single quotes, trailing commas, missing commas, comments, truncated literals, and many more issues.
- Minify JSON in the output pane with one click — toggle between pretty and compact at any time.
- Syntax highlighting with Prism for both light and dark themes.
- 100% client-side processing — no JSON is ever uploaded, logged, or transmitted.
- Dark and light mode with automatic system-preference detection.
- Keyboard shortcut — press Ctrl+Enter (or ⌘+Enter) to format immediately.
- Shareable links — pass JSON in the URL via
?json=<url-encoded>. - Undo the most recent auto-fix at any time.
How to use the JSON formatter
- Paste your JSON into the input panel on the left. Any text — valid, broken, JSON5, or even pasted JavaScript object literals — is accepted.
- Review the formatted output on the right. The output panel auto-validates and beautifies your JSON in real time as you type or paste.
- If errors are detected, the output pane shows the exact line, column, a human-readable message, and a suggested fix.
- Click Auto-fix to repair common JSON mistakes in a single step. You can click again to apply the next fix, or use the Undo Fix button to revert.
- Copy or minify the result — the Copy button copies the formatted output to your clipboard, and Minify collapses it to a single line.
Quick examples — before & after
Here are real broken-JSON inputs the auto-fix engine handles in one click. Each example shows what you might paste and the valid JSON the tool produces.
Example: fix unquoted JSON keys and values
Common when copying from JavaScript object literals or YAML.
{ name: alice, role: admin, active: true }
{
"name": "alice",
"role": "admin",
"active": true
}
Example: remove a trailing comma
ES2017 and JSON5 allow trailing commas; strict JSON does not.
{
"items": [1, 2, 3,],
"ok": true,
}
{
"items": [1, 2, 3],
"ok": true
}
Example: convert single quotes to double quotes
Pasting from Python, JavaScript, or YAML often produces single-quoted strings.
{'name': 'Alice', 'tags': ['admin', 'user']}
{
"name": "Alice",
"tags": ["admin", "user"]
}
Example: complete truncated literals
Cut-and-paste truncations get repaired automatically.
{ "active": tru, "deleted": fals, "owner": nul }
{
"active": true,
"deleted": false,
"owner": null
}
Example: strip JavaScript-style comments
JSON does not support comments. The fixer removes them while preserving any // that legitimately appears inside string values.
{
// top-level config
"host": "localhost",
"port": 8080 /* HTTP */,
"tls": true
}
{
"host": "localhost",
"port": 8080,
"tls": true
}
Example: quote CSS-style and compound values
Hex colours, percentages, sizes, ARNs, and version strings get wrapped automatically.
{
"color": #3b82f6,
"padding": 12px,
"scale": 100%,
"image": gcr.io/proj/svc:v1.2.3
}
{
"color": "#3b82f6",
"padding": "12px",
"scale": "100%",
"image": "gcr.io/proj/svc:v1.2.3"
}
Common JSON errors this tool can auto-fix
The auto-fix engine combines more than twenty independent detectors with a holistic dry-run check. The chain only offers a fix when it can prove the chain terminates at fully valid JSON, so you never get stuck in a half-broken state.
Unquoted keys ({ name: "Alice" })
JavaScript and YAML allow bare identifiers as object keys, but the JSON specification requires every key to be a double-quoted string. The fixer wraps each unquoted key in "…".
Single-quoted strings ({ 'a': 'b' })
JSON only allows double quotes. The fixer converts each single-quoted key or value to double quotes, escaping any inner double quotes safely.
Trailing commas ([1, 2, 3,])
Although ES2017 and JSON5 permit trailing commas, strict JSON does not. The fixer removes them in both arrays and objects.
Missing commas ({ "a":1 "b":2 })
Inserts the missing comma between adjacent members.
Comments (// line and /* block */)
JSON does not support comments. The fixer strips line and block comments from outside of string values, preserving strings that happen to contain //.
Truncated literals (tru, fals, nul)
Recognises common typos and rewrites them to true, false, or null respectively.
Python and JavaScript aliases (True, None, NaN)
Detects Python (True, False, None) and JavaScript (undefined, NaN, Infinity) values and rewrites or replaces them with valid JSON equivalents.
Unquoted values ("role": admin)
Bare identifiers used as values are quoted as strings, both in object position and inside arrays.
Compound and CSS-style values
Quotes complex tokens like #3b82f6, 100%, 12px, v1.2.3-rc.1, arn:aws:s3:::bucket, actions/checkout@v4, and IP:port pairs that would otherwise break the parser.
Unescaped newlines inside strings
If a string spans multiple physical lines because of a stray Enter key, the fixer escapes the literal newline as \n instead of forcing you to find it.
Unterminated strings
When the parser fails because of a missing closing ", the fixer searches likely insertion points and chooses the one that makes the rest of the document parse.
Smart-quote, semicolon, and equals-sign mistakes
Replaces smart quotes with straight ones, semicolons-between-members with commas, and "k" = v assignments with "k": v.
For situations the engine cannot safely repair — JavaScript function literals, Python lambdas, regular expressions, Helm/Go templates, embedded SQL, raw XML, or other domain-specific languages embedded in your input — the tool declines to autofix and instead displays a clear, specific error message explaining what was found and how to handle it manually.
Privacy & security
Your JSON never leaves your device. All parsing, validation, formatting, and auto-fixing happen in JavaScript that runs in your browser tab. There is no network request for the JSON you paste, no logging, no analytics on the content, and no third-party services involved in processing. You can verify this in your browser's Network developer tab — only static assets (HTML, CSS, JavaScript, the Prism syntax-highlighting library) are fetched.
Frequently asked questions
Is this JSON formatter free?
Yes. The Intelligent JSON Formatter is completely free to use, with no signup, no usage limits, and no data collection.
Does my JSON get uploaded to a server?
No. All formatting, validation, and auto-fix runs entirely in your browser using JavaScript. Your JSON never leaves your device — there is no network request involved in processing.
What does the Auto-fix button do?
Auto-fix runs an intelligent detector chain that identifies common JSON mistakes — unquoted keys, single quotes, trailing commas, missing braces, truncated literals, comments, and many more — and rewrites the input to valid JSON when possible.
What kinds of JSON errors can be auto-fixed?
Common fixable issues include: unquoted keys and values, single-quoted strings, trailing commas, missing commas between elements, JavaScript-style comments, truncated true/false/null literals, multi-line strings with unescaped newlines, semicolon separators, hex and version-like compound values, and many more — 20+ detectors in total.
What is the difference between minify and beautify?
Beautify formats your JSON with indentation and line breaks so it is easy to read. Minify removes all whitespace to produce a single-line, compact JSON suitable for transmission or storage. Use the Minify button in the output toolbar to toggle between the two.
Does this support large JSON files?
Yes. Because everything runs in your browser, you can format JSON files of essentially any size your browser can hold in memory — typically tens of megabytes — without any upload delay.
Can I share a formatted JSON link?
You can pre-fill the input by passing JSON in the URL: append ?json=YOUR_URL_ENCODED_JSON to the address. The page loads with your JSON already pasted.
What browsers are supported?
Any modern evergreen browser — Chrome, Edge, Firefox, Safari, Opera, Brave. The tool uses standard web APIs (no experimental features) and a small JavaScript runtime, so anything from the past several years works.
Are there keyboard shortcuts?
Yes. Press Ctrl+Enter (or ⌘+Enter on macOS) inside the input box to format immediately without waiting for the auto-format debounce.
Does the formatter support JSON5 input?
The formatter accepts many JSON5-style inputs (single quotes, unquoted keys, comments, trailing commas) and converts them to strict JSON. The output is always RFC 8259-compliant JSON — not JSON5 — because that is what almost every parser, API, and storage system expects.
How is this different from other JSON formatters?
Most online JSON formatters either reject broken JSON outright or apply a single naive fix. The Intelligent JSON Formatter runs an auto-fix detector chain with a holistic dry-run — it only offers a fix when it can prove the chain terminates at fully valid JSON. That means no half-broken intermediate states, and clear specific error messages when a fix is not possible.
Can I audit what the page does?
Yes. Open your browser's developer tools and inspect the Network tab. You will see the page loads only its own HTML, CSS, JavaScript, and the Prism syntax-highlighting library from a public CDN — there are no analytics calls, no third-party fetches, and crucially no upload of the JSON you paste.
Will my formatted JSON look the same as JSON.stringify output?
Yes. The formatter calls JSON.stringify(parsed, null, indent) internally, so the result is identical to what a JavaScript program would produce with JSON.stringify using your selected indent. Numbers, strings, booleans, and nesting are all rendered to the JSON specification.
Does the auto-fix ever make wrong guesses?
The fixer is conservative: it only offers a fix when the entire detector chain can be proven to terminate at valid JSON via a dry-run simulation. If your input is genuinely ambiguous (for example, a JavaScript function literal embedded in your JSON), the tool declines to autofix and shows a specific message describing what was found, rather than guessing.