JSON Formatter
Format, minify, sort keys, and convert between JSON objects and escaped strings.
How It Works
The JSON Formatter validates and beautifies any JSON document directly in your browser using the native JSON.parse engine — no upload, no server round-trip, no network access required after the first page load. Paste raw JSON into the input area, choose 2-space, 4-space, or tab indentation, then click Format to pretty-print, Minify to strip every byte of optional whitespace, Sort to alphabetise keys recursively (so two formatted files produce a stable, line-noise-free diff), Stringify to wrap the document in a quoted-and-escaped JSON string suitable for embedding inside another JSON value, or Destringify to reverse that wrapping. Errors are reported inline with the parser’s exact message and a position offset where parsing stopped, so you can pinpoint a missing comma or unbalanced brace immediately. Inputs over 1 MB are rejected to keep the browser tab responsive on pathological documents. Sort is fully recursive: nested objects are alphabetised at every level, which is the canonical preparation for diffing two configuration files generated by different tools. Everything runs client-side; the page works fully offline once cached.
Use Cases
- Debugging API responses from REST or GraphQL endpoints
- Tidying minified JSON config files before committing them
- Validating data files in CI without installing extra tooling
- Quickly checking that a payload matches the expected schema
Frequently Asked Questions
- Is my JSON sent to a server?
- No. Parsing runs entirely in your browser via the native JSON.parse engine — nothing leaves your device.
- What is the maximum input size?
- One megabyte. Larger inputs are rejected to keep the tab responsive.
- Why does Sort change nested objects too?
- Sort is recursive so deeply nested keys are also alphabetised — that is what produces stable diffs between two formatted JSON files.
- What does Stringify do?
- It wraps the JSON in a quoted, escaped string suitable for embedding inside another JSON value (e.g. an API request body).
- Does it support JSON5, comments, or trailing commas?
- No, only strict RFC 8259 JSON. Comments or trailing commas trigger a parse error.