How to format JSON
- Paste your JSON into the top box. It is checked as you type.
- Click Format to pretty-print it with 2 spaces, 4 spaces or tabs, or Minify to remove all whitespace.
- Copy the result or download it as a
.jsonfile.
Finding JSON errors
If the JSON is invalid, the tool shows the error message with its line and column, and clicking Format jumps to the problem in the input box. The most common mistakes are:
- A trailing comma after the last item:
[1, 2, 3,] - Single quotes instead of double quotes:
{'name': 'Alice'} - Keys without quotes:
{name: "Alice"} - Comments, which standard JSON does not allow
- A missing comma or closing bracket
FAQ
Is my JSON sent to a server?
No. Parsing and formatting happen in your browser, so it is safe to paste API responses, configuration files and data that contains private information.
Why did a very large number change?
JavaScript stores numbers with about 15–17 significant digits, so integers larger than 9,007,199,254,740,991 (such as some database IDs) can lose precision when formatted. Store such IDs as strings.
What does “Sort keys” do?
It sorts the keys of every object alphabetically, at every level. This makes two JSON files easier to compare with the Diff Checker.