Format JSON Online

Instantly beautify and validate JSON. Auto-fix errors. 100% client-side — your data never leaves your browser.

Rules:Smart QuotesConverts curly quotes (“” ‘’) to straight quotes. Always active.Non-Breaking SpacesReplaces non-breaking spaces (U+00A0) with regular spaces. Always active.Line EndingsNormalizes CRLF → LF and trims trailing whitespace per line. Always active.Removes invisible zero-width characters (U+200B, U+200C, U+200D) that silently break string comparisons.Strips the Byte Order Mark (U+FEFF) that causes “invalid character” errors in parsers and editors.Removes soft hyphens (U+00AD) from PDFs that show as garbled characters in code editors.Converts mixed tabs/spaces to a consistent indent width. Click to pick a size.Collapses all line breaks into one continuous paragraph. Great for reflowing PDF or email text.Control blank line density. Click to pick Keep 1 or Remove all.Text never leaves your browser
0 characters

Auto-Fix Errors

Fixes single quotes, trailing commas, and unquoted keys automatically. Turn on auto-fix and paste broken JSON — we'll repair it.

100% Private

All formatting happens in your browser. No server, no logs. Your API keys, configs, and data never leave your device.

Instant

Format even large JSON files in milliseconds using native browser APIs. No waiting, no spinners, no rate limits.

How to Format JSON Online

  1. Paste your JSON into the text area above. If you're in a different mode, the tool auto-detects JSON and suggests switching to Format JSON mode.
  2. Choose your options. Select 2-space or 4-space indentation, or minify. Enable “Auto-fix common errors” to repair broken JSON before formatting.
  3. Copy the result. Click “Copy Clean Text” or press Ctrl+K to copy the formatted JSON to your clipboard. You can also download it as a .json file.

What is JSON Formatting?

JSON (JavaScript Object Notation) is a lightweight data format used everywhere — APIs, configuration files, databases, and inter-service communication. In production, JSON is often minified: all whitespace is stripped to reduce file size and network bandwidth. A minified JSON object like {"users":[{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}]} is efficient for machines but nearly impossible for humans to read or debug.

Formatting (also called “beautifying” or “pretty-printing”) adds indentation and line breaks so that the structure becomes visible. Each nested level is indented, arrays are expanded, and you can immediately see the hierarchy. This makes it far easier to spot missing commas, mismatched brackets, incorrect nesting, or unexpected values.

Common JSON Errors We Auto-Fix

Strict JSON parsers reject input that doesn't follow the spec exactly. But in practice, JSON is often hand-edited or copied from JavaScript code where looser syntax is valid. Our auto-fix handles the three most common issues:

Error TypeBeforeAfter
Single quotes{'key': 'value'}{"key": "value"}
Trailing comma{"key": "value",}{"key": "value"}
Unquoted keys{key: "value"}{"key": "value"}

JSON Indentation Options

2-space indentation is the most widely used convention. It's the default in most JavaScript/TypeScript projects, prettier, and many API documentation tools. It balances readability with compact vertical space.

4-space indentation is preferred by some style guides (including Python's json.dumps default) and in contexts where deeper nesting needs to be more visually obvious. It uses more vertical space but can be easier to scan for deeply nested structures.

Minified (0 spaces) strips all whitespace, producing the smallest possible output. Use this for production payloads, API request bodies, configuration values stored in environment variables, or anywhere file size matters. A minified JSON object can be 30-60% smaller than its prettified equivalent.

Frequently Asked Questions

Is my JSON data sent to a server?

No. Unformat.online processes all JSON entirely in your browser using JavaScript's native JSON.parse() and JSON.stringify(). Your data never leaves your device. Verify by opening the Network tab in DevTools — zero requests are made during formatting.

What's the maximum JSON size I can format?

There is no hard limit. The tool uses native browser APIs which handle multi-megabyte JSON files efficiently. For very large files (10MB+), formatting may take a few seconds depending on your device.

Can I format JSON from an API response?

Yes. Copy the raw API response body and paste it directly. The formatter handles both minified and partially formatted JSON. If the response contains non-standard syntax (like JavaScript objects with unquoted keys), enable auto-fix mode.