JSON Formatter with Prettier
Format JSON using Prettier rather than a generic pretty-printer, so the output matches exactly what your editor writes on save.
This page opens with the JSON parser selected.
Why not the plain JSON formatter
Both produce valid, readable JSON. The difference is that this applies your Prettier settings, so a file formatted here will not produce a diff the next time someone saves it in an editor with Prettier configured.
If what you want is validation with a line and column on the error, the dedicated JSON formatter reports that more directly.
Parser choice still matters
Feeding JSON to the JavaScript parser appears to work and then reformats it under JavaScript rules, which can emit output that is no longer valid JSON. For files with comments, such as tsconfig.json, the JSON5 parser is the one that accepts them.
package.json and lockfiles
Formatting package.json is safe and produces no semantic change, but be aware that npm rewrites parts of it on install, so a formatted file can drift back. Some teams add it to .prettierignore for exactly that reason.
Never format a lockfile. It is generated, enormous, and reformatting it creates a diff nobody can review while gaining nothing.
Key order is preserved exactly
Prettier never sorts keys. JSON objects are unordered by specification, but the serialised text is not, and reordering would produce enormous diffs while breaking any consumer relying on document order.
If you want sorted keys that is a separate transformation and a deliberate one, not something a formatter should do behind your back.