What this JSON formatter does
This free JSON formatter and validator checks your JSON as you type, shows exactly where any error is, and turns valid JSON into neatly indented text or a compact one-line version. You can paste JSON, type it, or drop a .json file on the input box.
How to format JSON
- Paste your JSON into Your JSON, or drop a file on it.
- Look under the box: Valid JSON in green, or the error with its line and column.
- Pick the Indent: 2 spaces, 4 spaces or Tabs.
- Optional: switch on Sort keys A–Z.
- Click Format for readable JSON or Minify for the smallest version.
- Copy or Download the result.
Reading the error messages
When the JSON is invalid, the tool shows what the browser’s parser reported, the line and column, and the line itself with a ^ under the problem. Show in input jumps to that spot. For the most common mistakes it adds a hint:
- Trailing comma:
{"a": 1,}has a comma before the closing brace. Remove it. - Single quotes:
{'a': 1}must be{"a": 1}. - Unquoted keys:
{a: 1}must be{"a": 1}. - Comments: JSON has no
//or/* */comments. Delete them first.
The exact wording of an error depends on your browser. Safari gives no position, so there you get the message without a line number.
Problems and fixes
- Format and Minify are greyed out. The JSON is invalid. Fix the error shown below the input first.
- Special characters look wrong. Make sure the file is saved as UTF-8.
- Numbers change. Numbers beyond about 16 significant digits (like some IDs) lose precision in any browser JSON parser. Store long IDs as strings.
Privacy
Your JSON is checked and formatted in your browser and never leaves your device.
When Pro helps
Pro doesn’t add anything to this tool beyond removing ads.
Related tools
- Base64 encode and decode for encoded values inside JSON
- Case converter to turn labels into camelCase or snake_case keys
- Word counter for text fields with a length limit