If JSON will not parse, use a validator to locate the first syntax error. Fix it before trying to pretty-print the document. Common causes include trailing commas, unquoted property names, missing commas, and mismatched brackets. Then use a formatter to make valid JSON easier to inspect.
Parsing only proves the text follows JSON syntax. It does not prove required fields exist, values have the right types, or the receiving application accepts them. Compare important values before and after formatting, especially large numbers and escaped characters, and validate against a schema or application test when available.
Avoid pasting secrets or private payloads into an untrusted tool.