JSON Formatter and Validator
Format, validate and minify JSON. Finds the exact line and column of an error and explains it, and can sort keys.
Everything happens in your browser. Nothing you enter or choose is uploaded.
How to use the JSON formatter
- Paste your JSON, open a file, or choose Load example.
- Choose Format to make it readable, or Minify to make it compact. Turn on Sort keys to put every object's keys in alphabetical order, which makes two files easy to compare.
- Copy or download the result. If there is a mistake, the error message says where and why.
JSON rules in short
- Strings and keys use double quotes:
"name", never'name'. - No comma after the last item:
[1, 2, 3], not[1, 2, 3,]. - No comments, no
undefined,NaNorInfinity; usenullfor "nothing". - Numbers have no leading zeros or plus sign:
7,-0.5,1e6. - Line breaks and tabs inside a string must be written as
\nand\t.
Frequently asked questions
How do I format JSON?
Paste it in the left box (or open a .json file) and choose Format. The result is indented with 2 or 4 spaces or tabs, ready to copy or download. Minify does the opposite: it removes every space and line break to make the JSON as small as possible.
How do I find the error in my JSON?
Choose Validate (or just Format). If the JSON is invalid you get the line and column, the line itself with a marker under the problem, and a plain explanation. "Show in the text" puts the cursor right at the error.
What are the most common JSON mistakes?
A comma after the last item in a list or object, single quotes instead of double quotes, keys without quotes, comments, and a missing comma between two items. JavaScript allows most of these; JSON allows none of them.
Does the formatter change my numbers?
No. Numbers are kept exactly as you wrote them, even very large ones that JavaScript itself would round, so IDs and amounts stay intact. Strings and their escapes are kept as written too.
Is my JSON sent anywhere?
No. Everything runs in your browser, so you can safely format JSON that contains private data or API keys.
Is there a size limit?
Only your device's memory. Files of several megabytes format in about a second on a recent phone or computer.
Related tools
Browse all tools- .htaccess Redirect Generator Write .htaccess rules to force HTTPS, choose www or non-www, redirect old pages and set security headers, with the same rules for Nginx.
- Favicon Generator Turn an image or a letter into every favicon a site needs: favicon.ico, PNG sizes, Apple touch icon and web manifest, with the HTML to paste.
- HTTP Headers Checker See every response header a page sends and get a security grade from A+ to F, with the exact header to add for each gap.