JSON Formatter and Validator
Paste JSON to find out whether it is valid, and if it is not, see the line, the column and a plain-English reason. Valid JSON can be pretty-printed with 2 spaces, 4 spaces or tabs, minified onto one line, or have its keys sorted. Numbers and strings are kept exactly as you wrote them.
- Free
- No sign-up
- Runs in your browser
- Nothing uploaded
Format and validate JSON
Paste JSON here. It is checked as you type and never leaves your browser.
Paste some JSON to validate and format it.
Applies to every object, at every level. Arrays keep their order.
How to use it
Paste your JSON
Paste into the box, or choose “Load sample” to see how it works. The text is checked as you type.
Fix any error
If the JSON is invalid, a message gives the line, column and likely cause, with the offending line shown. “Go to the error” puts your cursor on the problem.
Pick a layout
Choose 2 spaces, 4 spaces, tabs, or Minify. Tick “Sort object keys” to put keys in A to Z order.
Copy or download
Copy the formatted text, or download it as a .json file.
Example: finding a missing quote
An API response will not parse and the error from your program just says “unexpected token”. Paste it here and the tool reports, for instance, “Property names must be in double quotes at line 3, column 4”, shows that line, and jumps to it. After the fix, the same text formats into a readable, indented document.
Common JSON mistakes and how to fix them
JSON is stricter than JavaScript. These are the errors this tool explains most often.
| Mistake | Example | Fix |
|---|---|---|
| Trailing comma | {"a": 1,} | Remove the comma after the last item. |
| Single quotes | {'a': 1} | Use double quotes: {"a": 1}. |
| Unquoted key | {a: 1} | Put the key in double quotes: {"a": 1}. |
| Comments | // note | Remove comments. JSON has no comment syntax. |
| Missing comma | {"a": 1 "b": 2} | Add a comma between properties: {"a": 1, "b": 2}. |
| Wrong literal | True, NaN, undefined | Use true, false or null. Numbers cannot be NaN or Infinity. |
| Leading zero | [01] | Write 1, or put the value in quotes if it is an identifier. |
| Raw line break in a string | "line one⏎line two" | Write the break as \n inside the string. |
Limits and limitations
- This validates strict JSON as defined in RFC 8259. Files that use comments, trailing commas, single quotes or unquoted keys (sometimes called JSON5 or JSONC) are reported as invalid.
- Nesting deeper than 1,000 levels is rejected.
- The tool checks the syntax of JSON. It cannot check your data against a schema or tell you whether the values make sense.
- Duplicate keys in an object are allowed by the syntax. This tool keeps both copies and shows a note, because most programs use only the last one.
- Very large documents can make the page slow, because the text is re-checked after each edit.
Frequently asked questions
Is my JSON uploaded?
No. Your JSON is processed by JavaScript running in your browser and is not sent to a server. The page itself still loads from a web server like any website. This site can load advertising or analytics scripts, but only after you accept them in the cookie notice. They are separate from the tools, which never pass the files or text you work with to them.
Does formatting change my numbers?
No. Numbers and strings are copied exactly as written. Many tools parse and re-write the JSON, which can silently change very large integers (12345678901234567890 becomes 12345678901234567000) or escape sequences. This tool does not.
Why does my program accept JSON that this tool rejects?
Some parsers are lenient and allow comments, trailing commas or single quotes. Those are not valid JSON, and other programs and services will refuse them, so it is safest to fix them.
What does sorting keys do?
It rearranges the keys of every object into A to Z order, which makes two documents easier to compare. Arrays keep their order because it is part of their meaning.
More tools
- Base64 Encoder & DecoderEncode text to Base64 or decode Base64 back to text, including the URL-safe form.Developer tools
- URL Encoder & DecoderPercent-encode or decode text, query values and whole URLs.Developer tools
- QR Code GeneratorTurn a link or text into a QR code and download it as a PNG or SVG.Developer tools