JSON Formatter, Validator & Repair — Free Online
Free online JSON formatter — format, validate, and repair JSON in your browser. Line numbers, error highlighting, sort keys, no signup.
Format, validate, repair, sort, and minify JSON in one click. PDFFlare's JSON Formatter is the fastest way to prettify a messy API response, fix a broken config, or check that a payload parses before you ship it. Line numbers, error highlighting, and a live stats bar are all built in.
All processing runs in your browser — your JSON never touches a server. Need to generate TypeScript types from a JSON sample? Try JSON to TypeScript. Need a spreadsheet from your API data? Use JSON to CSV.
Example: preserve the original number
Formatting adds whitespace without changing number tokens. For example:
{"id":9007199254740993,"active":true}
{
"id": 9007199254740993,
"active": true
}Repair can turn {id:1,} into valid JSON by quoting the key and removing the trailing comma. Repair is best-effort: review the result, and correct missing separators manually when they cannot be recovered.
How to Format JSON Online
Paste your JSON
Paste raw JSON into the input panel on the left. It can be minified, messy, or partially formatted — use Repair for common syntax mistakes.
Pick an action
Format pretty-prints with your chosen indent. Validate confirms it parses without changing the output. Repair fixes common JSON-adjacent mistakes (single quotes, trailing commas, comments). Sort Keys alphabetizes object keys recursively. Minify strips whitespace.
Copy or keep working
Click Copy Output to send the result to your clipboard. Or paste another payload into the input — the line numbers and live status bar update as you type.
When Do You Need a JSON Formatter?
Debugging API responses: Paste a raw fetch result to instantly see the structure with proper indentation, making it easy to locate fields, spot null values, and trace bugs.
Cleaning up configuration files: package.json, tsconfig.json, eslint.config — formatting them consistently makes diffs cleaner and code reviews faster.
Repairing broken JSON from copy-paste: Pasted JSON from a chat client or doc often has smart quotes, trailing commas, or comments. Click Repair and it's fixed in one step.
Validating before deployment: Catch syntax errors in JSON config files before pushing to production. Validate pinpoints the exact line and column.
Why Use PDFFlare for JSON Formatting?
Line Numbers + Error Gutter
Both panes have scroll-synced line numbers. Parse errors highlight the exact offending line in red, with a structured line/column message in the banner.
Repair Broken JSON
Single quotes, unquoted keys, trailing commas, and embedded comments — all fixable with one click. Each repair step is shown so you know what changed.
100% Browser-Based
Your JSON never leaves your device. Safe for sensitive API responses, secrets, or production payloads — no server uploads, no analytics on file contents.
No Signup Required
No account, no rate limits, no upgrade prompt. Open the tool, paste your JSON, get on with your day.
Frequently Asked Questions About JSON Formatting
Format, Minify and Sort Keys preserve number tokens, string escapes, duplicate keys and array order. For example, 9007199254740993 stays 9007199254740993. Sorting only changes object-key order. Other applications may still round large numbers or discard duplicate keys when parsing the output.
Both. PDFFlare's JSON Formatter uses the browser's native JSON parser, so any input that doesn't parse triggers a precise error message including line and column. The Validate button reports validity without modifying the output, and the input pane highlights the offending line in red.
The Repair button is a heuristic that handles the most common 'almost JSON' mistakes: single quotes (converted to double), unquoted object keys (quoted), trailing commas (removed), single-line and block comments (stripped), and smart-quote characters from copy/paste (replaced with straight quotes). Repair is best-effort: inspect its changes and fix any remaining error manually. Missing commas and arbitrary JSON5 syntax are not automatically supported.
Yes. The Indent dropdown in the toolbar offers 2 spaces (default), 4 spaces, and Tab. Whatever you pick is used by Format, Sort Keys, and the Repair button's pretty-printed output.
Format pretty-prints with indentation and line breaks for readability. Minify strips every optional whitespace character to produce the most compact JSON, which is what you want for production API payloads or environment variables.
No. Object keys are sorted alphabetically, recursively at every level. Array order is preserved because array order is data — not just layout. Sorting an array would corrupt the meaning.
There's no fixed limit. Everything runs in your browser, so the practical ceiling is your device's available memory. Large or deeply nested inputs can take longer and may exceed browser limits.
Yes. PDFFlare's JSON Formatter is 100% client-side — your JSON never leaves your browser. No server processing, no analytics on file contents, no retention. This makes it safe for sensitive API responses, secrets, or production payloads.
Both panes have a left-side gutter showing line numbers, scroll-synced with the editor. The status bar at the bottom shows live stats — input lines, byte size, parsed depth, key count, and output stats — recomputed on every keystroke so you always know what you're working with.
Conversions live in dedicated tools so each gets its own focused page: JSON to TypeScript and JSON to CSV. The Suite Nav at the top of this page links to all JSON tools — one click to switch.
Click Repair. It strips both single-line (//) and block (/* */) comments, removes trailing commas, and quotes unquoted object keys — the three biggest JSON5/JSONC features. If repair succeeds, the output is parseable JSON. Otherwise the tool reports the remaining error.