← All tools

JSON formatter

Validate, format and minify JSON while preserving number and string tokens.

Check and format JSON

Validate strict JSON, find duplicate keys and format or minify a separate copy. Your file stays in this browser.

Input: up to 512 KiB, 128 nesting levels and 50,000 tokens. Output: up to 2 MiB. UTF-8 files only. A leading BOM is preserved in the download; some JSON consumers reject BOMs. Comments and trailing commas are rejected.

Only whitespace between tokens changes. Number spelling, negative zero, escapes, key order and duplicate keys are preserved. Duplicate keys remain ambiguous for other apps; this tool does not choose a winning value. Formatting uses LF line endings.

Choose a file or paste JSON, then press Check and convert.

Worked example

Read an API response without changing a long identifier

Format the JSON below, which contains a large id value. This separates whitespace formatting from value conversion.

Example input

{"id":9007199254740993,"enabled":true}
  1. Paste the JSON, choose two-space indentation and run validation and conversion.
  2. Check that the id still ends in 993 and enabled is still true.
  3. Convert again with minification to return to the original single-line JSON. Use the full-result download to save a copy.

What to check in the result

Only whitespace and line layout change; 9007199254740993 is not rounded. Syntax validation does not check the fields or business rules required by an API.

{
  "id": 9007199254740993,
  "enabled": true
}

Troubleshooting

Why do comments or a trailing comma fail validation?
This tool accepts strict JSON. Remove comments and the comma after the final object or array item from a copy, then validate again. JavaScript object source and JSON have different syntax rules.
Why can conversion succeed with a duplicate-key warning?
The same key occurs more than once in one object. The tool does not delete entries or choose a winning value. Check the source, decide the intended keys and values, and validate again before using it in the destination application.