JSON Formatter, Validator & Repair Tool
Format, minify, validate, and repair JSON instantly in your browser. Sort keys alphabetically, auto-format on paste, download as file, escape/unescape strings — free, no sign-up, 100% client-side.
The most complete free JSON formatter
Most JSON formatters do three things: format, minify, validate. This one does seven. On top of the basics you get JSON Repair (auto-fixes trailing commas, single quotes, JS comments, and unquoted keys), Sort Keys (alphabetical, recursive — great for diffing), Auto-format on paste, Escape / Unescape for embedded string literals, and a Download button for saving output as a file. All running locally — no upload, no account, no limit on payload size.
How to use the JSON Formatter
- Paste your JSON into the Input box (or click Sample to load a realistic example).
- Click Format for a readable, indented version. Choose 2 spaces, 4 spaces, or tab indentation.
- Click Minify to strip all whitespace for production use.
- Click Repair if your JSON has common syntax errors — trailing commas, single quotes, or JavaScript comments.
- Toggle Sort Keys to reorder all object keys alphabetically across every nesting level.
- Enable Auto-format to have output update live as you type.
- Hit Copy or Download to use the output.
When to use JSON Repair
API responses from some services, hand-edited config files, and JavaScript object literals often look like JSON but aren't strictly valid. The most common culprits: trailing commas that JavaScript allows but JSON forbids, single-quoted strings, inline comments, and unquoted keys. The Repair button handles all four automatically — it rewrites the input, formats it, and shows you the corrected version.
Privacy and data handling
Everything runs in your browser's JavaScript engine. No data is sent to any server, logged, or stored. This matters when you're working with API responses that contain credentials, tokens, or customer data. Paste anything — it never leaves your device.
Frequently asked questions
- What is JSON formatting?
- JSON formatting (also called beautifying or pretty-printing) adds indentation, line breaks, and consistent whitespace to raw or minified JSON so it's human-readable. This tool formats instantly in your browser with 2-space, 4-space, or tab indentation — no upload required.
- Is my JSON sent to your servers?
- No. The JSON Formatter runs entirely in your browser using JavaScript. Your data is never uploaded, logged, or stored anywhere. This makes it safe to use with API responses containing credentials, customer records, or any sensitive data.
- What's the difference between Format and Minify?
- Format expands JSON with indentation and line breaks for human readability. Minify removes all whitespace to make the payload as compact as possible — useful for production APIs, HTML embedding, or reducing bandwidth. The stats bar shows you the size savings.
- How does the JSON Repair feature work?
- The Repair button auto-fixes the most common JSON errors: trailing commas before } or ], single quotes changed to double quotes, JavaScript-style // and /* */ comments removed, and bare unquoted object keys wrapped in double quotes. If the repaired JSON still fails to parse, the exact error is shown.
- What does Sort Keys do?
- Enabling the Sort Keys toggle reorders all object keys alphabetically — recursively across every nested object. This is useful for diffing two JSON blobs, normalizing API responses for comparison, or enforcing consistent key order in configuration files.
- What does Auto-format do?
- With Auto-format enabled the output updates automatically as you type or paste — no need to click Format. When disabled, formatting only runs when you click a button, which is better for large payloads where live updates would be slow.
- What if my JSON is invalid?
- When JSON is invalid, the tool shows the parser's exact error message including the position of the problem. Common issues include trailing commas, single quotes instead of double quotes, JavaScript comments, and unquoted keys. Try the Repair button first — it fixes most of these automatically.
- What is JSON escape / unescape?
- Escape converts a plain text string into a JSON string literal — wrapping it in double quotes and escaping special characters like newlines ( ), tabs ( ), and backslashes (\). Unescape does the reverse: it decodes a JSON string literal back to raw text. Useful when JSON is embedded inside another string.
- Can I download the formatted JSON?
- Yes. Click the Download button in the output panel to save the current output as a formatted.json file. This works for both formatted and minified output.
- Does this work offline?
- Yes. Once the page loads, all processing happens locally in your browser's JavaScript engine. You can disconnect from the internet and the tool keeps working.
Related tools
- QR Code Generator
Generate QR codes for URLs, text, Wi-Fi, and more. Download as PNG.
- Password Generator
Generate strong, random passwords with custom length and character sets.
- Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to plain text.
- URL Encoder / Decoder
Encode or decode URLs and query strings with percent-encoding.
- Hash Generator
Generate SHA-1, SHA-256, SHA-384, and SHA-512 hashes instantly.