Start with the kind of input you actually have
A JSON formatter is useful when an API response is valid but difficult to inspect. It cannot turn every JavaScript expression into JSON. Before changing the text, identify whether you have a JSON document, a JavaScript object literal, a line-delimited stream, or a string that contains an encoded document. These formats look similar, but they require different handling.
For example, {"active":true} is JSON. {active:true} is not: JSON property names need double quotes. A trailing comma after the last property is another common cause of failure. Remove one error at a time and keep an untouched copy, especially when investigating an API bug. Making a broken example look tidy is not the same as finding its cause.
A repeatable local workflow
Start with a small representative sample. Paste it into the formatter, use Format, and read the nesting before copying the result. If parsing fails, check the location described by your browser’s parser. Error wording varies between browsers, so the important evidence is the input and the failing structure, not the exact phrasing of the error message.
Try a top-level array as well as an object. Then check an empty object, a null value, an escaped quote, and a non-English string. These cases catch assumptions hidden by simple examples. Use Minify only after the document parses. It removes insignificant whitespace, not data fields, and is not a substitute for compression over the network.
Know where precision can disappear
This tool uses JavaScript’s built-in JSON parser. Ordinary JavaScript numbers cannot exactly represent every large integer. An account or event identifier that looks like a number may therefore need to be stored as a string. The formatter rejects unsafe unquoted integers instead of silently changing an ID. It also rejects documents larger than 200 KB to keep the page responsive.
Duplicate property names are a separate issue. A document such as {"role":"reader","role":"editor"} leaves only the last value after JSON.parse. The formatter is not a duplicate-key auditor. If you must preserve exact bytes, signatures, numeric spelling, or duplicate entries, keep the original document and use a parser designed for that requirement.
A small verification table
| Input | Expected result | What it checks |
|---|---|---|
| {"active":true} | An indented object | Basic valid JSON |
| {"name":"工具"} | Text stays readable | Unicode handling |
| {"id":"9007199254740993"} | ID remains a string | Identifier preservation |
| {"value":1,} | Validation error | Trailing-comma rejection |
Keep sensitive material out of your test cases
Formatting runs on this page, without uploading the document. That does not make every browsing environment private: extensions, shared computers, and screen recording can still matter. Replace live credentials and customer records with synthetic examples before debugging. When sharing a problem, include the smallest input that demonstrates it and the expected structure, rather than an entire production response.
The useful outcome is a document you understand and can reproduce, not merely one with attractive indentation. Review the transformed output against the original before using it in another system.