JSON Formatter and Validator
Paste JSON to pretty-print it, check that it is valid, shrink it to one line, or sort its keys.
Characters: 0Words: 0Lines: 0
What this tool does
- Format / Validate: indents the JSON with two spaces so it is easy to read, and reports an error if it is not valid.
- Minify: removes all extra spaces and line breaks to make the JSON as small as possible.
- Sort keys: puts the keys of every object in alphabetical order, which makes two JSON files easier to compare.
The rules of valid JSON
- Keys and text values must use double quotes, not single quotes.
- No trailing comma after the last item in an object or list.
- No comments.
- Values can only be text, numbers, true, false, null, objects or lists.
Reading an error message
When JSON is invalid the message names the unexpected character and its position in the text. Go to that position: the real mistake is often just before it, such as a missing comma or an extra closing bracket.
A note on very large numbers
JSON numbers are read as ordinary JavaScript numbers, so integers above 9,007,199,254,740,991 can lose precision when formatted. If you work with very large IDs, keep them as text.
How to use the JSON Formatter tool
- Paste your JSON into the box.
- Click Format / Validate. If the JSON has a mistake, a message shows where.
- Use Minify for a compact one-line version, or Sort keys to put object keys in A-Z order, then copy the result.
Frequently asked questions
What is JSON?
JSON (JavaScript Object Notation) is a text format for data made of objects { }, lists [ ], strings, numbers, true, false and null. Most web APIs use it.
How do I validate JSON?
Paste it and click Format / Validate. If it is valid, it is shown neatly indented; if not, you get an error with the position of the problem.
What are common JSON mistakes?
Trailing commas, single quotes instead of double quotes, unquoted keys, comments and missing brackets are the usual causes of invalid JSON.
Is my JSON uploaded?
No. It is parsed in your browser, so API responses and config files with private data stay on your device.