Fix JSON formatting errors without losing data
Diagnose trailing commas, single quotes, large numbers and escaped text before formatting a JSON payload.
Validate before changing the payload
JSON requires double-quoted property names and strings. A trailing comma after the last array item or object property is invalid, and comments are not part of standard JSON. Start with the first reported error, fix it in a working copy and validate again. A later error may be a consequence of the first missing quote or bracket. Keep the untouched input for comparison.
Distinguish escaping from corruption
A backslash inside a JSON string is escaped as \. An embedded quote is written as ". A literal line break inside a quoted string is invalid; use the escaped newline sequence instead. When an API returns a JSON string containing another JSON document, the outer parse may correctly return a string rather than an object. Inspect the declared response contract before attempting to parse it twice.
Protect large identifiers
Ordinary JavaScript numbers cannot represent every integer above 9,007,199,254,740,991 exactly. A parse-and-stringify formatter may round such a number. If a value is an identifier, an account code or an exact integer outside the safe range, preserve it as a quoted string upstream or use a lossless JSON parser. Check the first and last digits after formatting; indentation is not proof that the data stayed unchanged.
Compare the result and use a comfortable view
Use the text difference tool to compare the original and formatted versions. Expect whitespace changes, but investigate changed values, missing keys or altered escaping. Duplicate object keys need special attention because parsers commonly keep only the last value. The existing formatter follows the site’s available appearance settings; this guide does not promise a separate dark-mode switch. For long sessions, use browser zoom and a readable line width instead of shrinking text to fit the entire document.