JSON formatter and validator
Paste JSON to indent it neatly, check that it is valid, or compress it to one line. If something is wrong, you see the line and column of the first error.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Paste JSON in the left box, or type it.
- Choose an indent: 2 or 4 spaces, a tab, or Minify for a single line.
- Copy the result. If the JSON is invalid, the line and column of the first error are shown instead.
How validation works
The validator reads the text character by character, following the JSON standard (RFC 8259). It stops at the first character that cannot be there and reports its position. Lines and columns are counted from 1.
{
"a": 1,
}
Here the error is at line 3, column 1: after a comma JSON expects another key, but finds }.
Common errors
| Problem |
Wrong |
Right |
| Trailing comma |
[1, 2,] |
[1, 2] |
| Single quotes |
{'a': 1} |
{"a": 1} |
| Unquoted key |
{a: 1} |
{"a": 1} |
| Comments |
// note |
not allowed in JSON |
| Special values |
NaN, undefined |
null or a number |
Tips
Sorting keys makes two versions of the same object easy to compare. For files that people edit, 2 spaces is the most common indent; for sending data, minify it.
Frequently asked questions
Why is my JSON invalid?
The most common causes are a comma after the last item, keys or strings in single quotes, comments, and unquoted keys. JSON allows only double quotes and no trailing commas.
Is my data sent to a server?
No. Formatting and validation run in your browser, so you can safely paste API responses or configuration files.
What does minify do?
It removes all spaces and line breaks that are not inside strings, which makes the JSON as small as possible for sending or storing.
Does sorting keys change the data?
No. JSON objects have no meaningful key order, so sorting only changes how the text looks. Array order is kept as it is.
Are large numbers kept exactly?
Numbers are read as standard double-precision values, so integers above 9,007,199,254,740,991 can lose their last digits. Keep such IDs as strings.