Text & developer
JSON Formatter and Validator
Paste JSON to check that it is valid and to lay it out neatly with 2 spaces, 4 spaces or tabs, or squeeze it into one line. If something is wrong, the tool tells you in plain words what and where, with the line and column.
Loading tool…
How to use the JSON Formatter
- Paste your JSON into the input box, or drop in a .json file.
- Choose Format (with 2 spaces, 4 spaces or tabs) or Minify. Tick “Sort keys” if you want keys in alphabetical order.
- If the JSON is invalid, read the message and fix the marked place. The result updates as you type.
- Copy the result or download it as a file.
Tips for better results
- The most common mistakes are a trailing comma after the last item, single quotes instead of double quotes, keys without quotes, and comments. The error message names these.
- Minify before sending JSON in a request or storing it, and format it when you need to read or review it.
- Sorting keys makes two versions of a file easier to compare in a diff tool.
Limitations you should know about
- The tool follows the strict JSON standard (RFC 8259). JSON5 and “JSON with comments”, which allow comments and trailing commas, are reported as errors.
- Numbers and strings are kept exactly as you typed them, so very large numbers do not lose digits. Note that most programming languages cannot represent integers above 9,007,199,254,740,991 exactly, and the tool warns you when it sees one.
- If an object repeats a key, both entries are kept and a warning is shown. Programs that read the file will usually keep only the last one.
- Nesting deeper than 512 levels is refused. Very large files (many megabytes) may be slow in a browser tab.
Frequently asked questions
What makes JSON invalid?
Common causes are trailing commas, single-quoted strings, unquoted keys, comments, missing commas between items and unclosed brackets. The validator names the problem and shows the line and column.
Is my JSON uploaded?
No. It is checked and formatted in your browser. Nothing is sent to a server, so it is safe to paste internal data, although you should still avoid pasting secrets into any web page you do not trust.
Why does the tool keep big numbers exactly?
Browsers normally turn numbers into 64-bit floating point, which rounds integers above 2^53. This tool leaves each number as written so reformatting never changes your data.
What is the difference between format and minify?
Format adds line breaks and indentation so humans can read it. Minify removes all optional spaces and line breaks to make the file smaller. Both keep the same data.
Guides that use this tool
Related tools
- Base64 and URL Encoder Encode and decode Base64 and percent-encoded URLs, with proper UTF-8 and URL-safe options.
- Text Case Converter Change text to upper case, lower case, sentence case, title case, camelCase, snake_case, kebab-case and more.
- Word Counter Count words, characters, sentences and paragraphs, with reading time and the most used words.