JSON Formatter & Validator
Paste JSON to beautify, validate or minify it instantly. Errors point to the exact line and column, common mistakes can be fixed in one click, and nothing leaves your browser.
At a glance
- Formats JSON with 2 spaces, 4 spaces or tabs, or minifies it to a single line.
- Validates strictly against the JSON standard (RFC 8259) and reports each error with its line and column, highlighting the exact spot.
- Fix mistakes mode repairs comments, trailing commas, single quotes, unquoted keys and Python-style True/False/None.
- Keeps numbers exactly as written: large integers such as 12345678901234567890 are not rounded, unlike JavaScript’s JSON.parse.
- Preserves key order and warns about duplicate keys; can sort keys alphabetically at every level.
- Includes a collapsible tree view for exploring large or deeply nested JSON.
- Runs entirely in your browser: pasted JSON — API responses, tokens, configs — is never uploaded or saved.
Step by step
How to format and validate JSON
- 1
Paste your JSON
Paste into the Input box, click Open file to load a .json file, or try the Sample.
- 2
Read the result
Valid JSON is formatted instantly on the right. If it is invalid, the error bar shows the line, column and reason.
- 3
Fix any errors
Click Show in input to jump to the problem, or Fix automatically to repair comments, trailing commas and quotes.
- 4
Copy or download
Pick 2 spaces, 4 spaces, tabs or Minify, optionally sort keys, then copy the output or download it as a .json file.
Features
Everything you need, nothing you don’t
Precise error messages
Instead of “Unexpected token”, you get a plain-English message such as “Expected ',' or '}' after property value” with the line, column and a pointer to the character.
One-click repair
JSON copied from JavaScript, config files or Python often has comments, trailing commas or single quotes. Fix mistakes converts it to valid JSON and lists every change.
Exact numbers
IDs, prices and big integers are kept character-for-character, so formatting never silently changes your data.
Tree view
Expand and collapse objects and arrays to explore large responses, with item counts at every level.
Beautify or minify
Choose 2 spaces, 4 spaces or tabs for readability, or minify to remove every unnecessary byte before shipping.
Private by design
Nothing is sent to a server and nothing is stored, so it is safe for API keys, tokens and customer data.
The most common JSON errors — and how to fix them
JSON is stricter than JavaScript. These mistakes cause almost every “invalid JSON” error. All of them except missing commas, missing brackets and leading zeros can be repaired automatically with Fix mistakes.
| Error | Invalid | Valid |
|---|---|---|
| Trailing comma | {"a": 1,} | {"a": 1} |
| Single quotes | {'a': 'b'} | {"a": "b"} |
| Unquoted key | {a: 1} | {"a": 1} |
| Comments | {"a": 1 // note} | {"a": 1} |
| Missing comma | {"a": 1 "b": 2} | {"a": 1, "b": 2} |
| Python literals | {"ok": True, "x": None} | {"ok": true, "x": null} |
| Leading zero | {"n": 007} | {"n": 7} |
| Raw line break in a string | "line one ↵ line two" | "line one\nline two" |
Why numbers stay exact here
JavaScript stores every number as a 64-bit float, so JSON.parse silently rounds integers above 9,007,199,254,740,991: 12345678901234567890 becomes 12345678901234567000. That corrupts order IDs, tweet IDs and account numbers. This formatter keeps each number’s original text, so the output is exactly what you pasted — only the whitespace changes.
Pretty-printed vs minified JSON
- Pretty-printed (2 or 4 spaces, or tabs) is for people: logs, config files, code reviews and documentation.
- Minified removes all optional whitespace and is for machines: API payloads, local storage and anything sent over the network. For typical JSON it is 10–30% smaller than 2-space formatting, before gzip.
- Sorted keys make two JSON documents easy to compare in a diff, because the same keys always appear in the same order.
JSON syntax in 60 seconds
- Values are strings, numbers,
true,false,null, objects{}or arrays[]. - Strings and keys use double quotes only. Escape
"as\"and a backslash as\\. - Items are separated by commas, with no comma after the last one.
- Numbers have no leading zeros, no
+sign, and noNaNorInfinity. - Comments are not part of JSON. Use JSONC or JSON5 files if you need them, and strip comments before parsing.
FAQ
Frequently asked questions
Is it safe to paste API responses or tokens here?
How do I find where my JSON is broken?
What does “Fix mistakes” change?
Why does my number look different in other tools?
Can it handle large JSON files?
Does it support JSON5 or JSONC?
What happens with duplicate keys?
Can I download the result?
Keep going
Related tools
Word Counter
Free online word counter: count words, characters, sentences and paragraphs as you type, with reading time, keyword density, readability and limits.
Password Generator
Generate strong, random passwords, memorable passphrases and PINs with a cryptographically secure generator. Free, instant and private — nothing is stored.
XML to JSON Converter
Convert XML to JSON and JSON to XML online. Keeps attributes, arrays and leading zeros intact, shows exact error lines and never uploads your data.
DNS Lookup
Free DNS lookup: check A, AAAA, CNAME, MX, NS, TXT, SOA and CAA records of any domain, see SPF and DMARC, and do reverse DNS for an IP address.
DNS Propagation Checker
Check DNS propagation worldwide: see the A, CNAME, MX, NS or TXT answer from 7 public DNS networks and 18 ISPs in 15 countries, and track the change.
JSON to CSV Converter
Convert JSON to CSV for Excel or Google Sheets: nested objects become columns, lists are kept and big numbers stay exact. Also CSV to JSON. No upload.
Last updated Report a problem or suggest a feature