What does this JSON formatter do?
This tool cleans up strict JSON in the browser so you can either read it comfortably or compress it into a single line. The current page exposes three core capabilities:
pretty: expands JSON with indentation for inspection and debugging.minify: removes extra whitespace for transport or embedding.sortKeys: recursively sorts object keys so repeated comparisons are easier to read.
This is not a JSON5 editor and not a schema validator. The implementation relies on native JSON.parse(), so it does not accept comments, trailing commas, single quotes, or unquoted keys.
When key sorting is enabled, object keys are reordered recursively, but array order stays intact. That makes the output useful for readability and review, but not a full canonical JSON representation.
Good fits
- Inspecting REST or GraphQL payloads.
- Cleaning up fixtures and config snippets.
- Compressing JSON before pasting into env vars or query parameters.
- Normalizing field order before using a diff tool.
References
- RFC 8259 defines valid JSON syntax.
- ECMA-404 describes the core JSON grammar.
- MDN documents JSON.parse() and JSON.stringify().