JSON Formatter & Validator
Beautify, minify and validate JSON with exact line-and-column error messages — processed entirely in your browser. Safe to use with API keys and private data.
| Mistake | Fix |
|---|---|
Trailing comma: {"a":1,} | Remove the comma before } or ] |
Single quotes: {'a':1} | Use double quotes for keys and strings |
Unquoted key: {a:1} | Wrap keys in double quotes: {"a":1} |
| Comments in JSON | Not allowed — remove // or /* */ comments |
Your JSON is parsed and formatted entirely in your browser using a token-preserving JSON parser. There is no upload step or server involved, and the tool does not upload or save your input. Avoid sharing sensitive output or using this page on a shared device.
How this tool works
Paste or type JSON into the input box, then click Format to beautify it with your chosen indentation, or Minify to strip all unnecessary whitespace. Both actions validate the JSON first — if it's invalid, you'll see exactly which line and column caused the problem instead of a generic error.
The formatter preserves the original number and string tokens. Large integer IDs, decimal precision, exponent notation and duplicate object properties are retained rather than converted to JavaScript numbers or objects. Only whitespace changes unless you choose key sorting.
Frequently asked questions
Does this tool send my JSON data anywhere?
No. Parsing, formatting, validating and minifying all happen locally in your browser using a token-preserving JSON parser. The tool does not upload or save your JSON. Be careful when copying or sharing output that contains private data.
What's the difference between formatting and minifying?
Formatting (beautifying) adds consistent indentation and line breaks so JSON is easy to read. Minifying removes all unnecessary whitespace to produce the smallest possible file size, which is typically what you'd send over a network or store.
Why does it say my JSON is invalid?
The most common causes are a trailing comma after the last item, single quotes instead of double quotes, unquoted property names, or a missing closing bracket. The tool reports the line and column at which its parser found a syntax problem.
Can I sort JSON keys alphabetically?
Yes, enable "Sort keys alphabetically" before formatting or minifying and every object's keys will be reordered alphabetically at every nesting level. Array order is always preserved.
Is there a size limit?
Input is limited to 5 MiB of UTF-8 JSON, 100 nested containers and 500,000 values to keep processing manageable. Formatted output is limited to 16 million characters; use Minify if indentation would exceed that limit.
Is this JSON formatter free?
Yes, completely free with no account, signup or daily usage quota. Input size and nesting limits keep processing manageable.
Preserving JSON numbers and object properties
For example, {"id":9007199254740993,"rate":1.2300,"huge":1e400} keeps every number exactly as written. Duplicate property names are also kept and reported because downstream programs may interpret them differently. Sorting uses Unicode string order and leaves arrays unchanged.
JSON comments, trailing commas, NaN, Infinity and JavaScript expressions are invalid. Input is never executed. Use Ctrl or Command + Enter to format. Editing the input clears the previous output to prevent accidental copying of an outdated result.
Examples and practical checks
Understand the result before using it elsewhere.
- Explore Developer ToolsCompare tools and their limits
- How we test these toolsMethods, verification and limitations