JSON Formatter & Validator

Format and validate JSON instantly. Fix common errors automatically — trailing commas, curly quotes, Python-style True/False/None, and unquoted keys. Sort keys alphabetically, minify for production, upload files or load from a URL.

json-formatter.tool
Indent:
Input JSON
Output

Why Your JSON Keeps Breaking

The most common JSON errors are not complex — they are small, invisible mistakes. A trailing comma after the last item. Curly quotes (“like this”) instead of straight quotes ("like this") that Word and mobile keyboards introduce. Python-style True, False, None instead of JSON's lowercase equivalents. Unquoted key names copied from JavaScript object literals. The Fix & Format button catches and corrects all of these automatically before formatting.

Format vs Fix & Format

Format parses your JSON as-is and formats it if valid. If there are errors it shows the exact position. Fix & Format first attempts to repair common mistakes — removing trailing commas, replacing curly quotes, stripping // and /* */ comments, correcting True/False/None, and wrapping bare keys in quotes — then formats the result. It shows what changed so you can review.

Sort Keys

Tick "Sort keys" before formatting to output all object keys in alphabetical order at every level of nesting. Useful for diffing two JSON objects (sorted output makes changes easier to spot), for normalising API responses in tests, and for producing consistent output when the key order from the source is unpredictable.

Load From URL

Click Load URL and paste any public API endpoint to fetch and format the JSON response without leaving the page. Useful for quickly inspecting the shape of an external API. Note that some APIs block cross-origin requests — if loading fails, copy the response from your browser's Network tab instead.

Frequently Asked Questions

Fix & Format applies a set of automatic repairs before parsing: it replaces curly/smart quotes with standard double quotes, removes JavaScript-style // and /* */ comments, strips trailing commas before closing braces and brackets, lowercases Python-style True/False/None to true/false/null, and wraps unquoted keys in double quotes. These are the most common reasons JSON copied from documentation, blog posts, or Python code fails to parse. Standard Format does none of this — it only accepts strictly valid JSON.
Curly or smart quotes are typographic quotes used by word processors, some note-taking apps, and mobile keyboards. Standard JSON requires plain straight double quotes. If you wrote or edited JSON in Word, Google Docs, Notion, or on a phone, curly quotes are often introduced automatically. The Fix & Format button replaces them. Going forward, always use a plain text editor or code editor for JSON.
JavaScript object literals allow unquoted keys ({name: "value"}), single-quoted strings, trailing commas, and comments. Standard JSON requires double-quoted keys and string values, no trailing commas, and no comments. This is why JavaScript objects copied directly often fail JSON validation. The Fix & Format button handles the most common conversions, but complex cases (functions as values, computed property names) cannot be converted automatically.
No. JSON objects are technically unordered — the specification does not define a key order, and well-written code that parses JSON never depends on key order. Sorting is purely a cosmetic operation that makes large JSON objects easier to read and compare. The data values and structure are completely unchanged.
The upload button accepts files up to 10MB. For files under a few megabytes, formatting is near-instant. For larger files, performance depends on your device — browsers allocate limited memory for JavaScript operations. For files over 10MB, command-line tools like jq (jq . file.json) or code editors like VS Code with the Prettier extension handle them more efficiently.
Yes. All processing happens in your browser using JavaScript. Your JSON is never sent to any server. You can verify this by checking your browser's network tab while using the tool — no requests are made to any external server when you format, fix, or validate. This makes it safe to paste API keys, tokens, and private configuration data.