About the JSON Formatter
The formatter parses your input with a strict RFC 8259 parser and re-serializes it with JSON.stringify, so the output is always valid JSON with consistent indentation: 2 spaces (the most common style in JavaScript projects), 4 spaces (Python's json.dumps(indent=4) default), a tab, or fully minified. Formatting never changes values — strings, numbers, booleans and null come out exactly as parsed.
When parsing fails, the error names the exact position and the usual cause: a trailing comma before }, single-quoted strings, unquoted property names, comments, undefined or NaN, or Python literals such as True and None. These are the mistakes that appear when JSON is written by hand or copied from JavaScript source.
Sort keys A→Z orders object keys recursively by code point, which makes two API responses or config files easy to compare in a diff. Array order is never changed. Two details worth knowing: duplicate keys are collapsed to the last value (the status line warns you), and integers larger than 253 − 1 (9007199254740991) lose precision in JavaScript — the tool flags them so you do not silently corrupt 64-bit IDs. Everything runs locally in your browser; nothing is uploaded.
How to use it
- Paste JSON into the input box, or open a .json file.
- Choose 2 spaces, 4 spaces, Tab or Minify.
- Tick Sort keys A→Z if you want a stable key order.
- Fix any error shown at the reported line and column.
- Copy the result or download it as data.json.
Frequently asked questions
Why does my JSON fail with a trailing comma?
} or ].Can I format JSON with comments?
// and /* */ are reported as errors. Files such as tsconfig.json use the JSONC dialect; strip the comments first or use an editor that understands JSONC.