JSON Formatter
Pretty-print JSON with indentation, optional key sorting, and minify. The result updates as you type.
Input
Indentation
Style
Keys
Convert to
Output
Private by design
This conversion runs entirely in your browser. Your text is not sent to a server.
Tip
2-space indent is the usual default. Sort keys when you want a stable diff. Minify on this page if you only need a compact payload.
How to convert with JSON Formatter
Paste JSON in the input box.
Pick indent (2, 4, or tabs), sort keys, or minify — the result updates as you type.
Use Convert to to open JSON Minifier or JSON → TypeScript with the same JSON.
Copy the formatted result. Invalid JSON shows an error instead of output.
When should you use it?
Format
Pretty-print JSON with indent and optional key sorting.
Minify
Strip whitespace from valid JSON for smaller payloads.
Types
Turn a JSON sample into TypeScript interfaces.
Stays here
JSON never leaves this tab.
Your JSON stays private.
Formatting, minify, and TypeScript generation run entirely in your browser.
About formatting JSON in the browser
JSON Formatter pretty-prints objects and arrays as you type. Indent may be 2 spaces, 4 spaces, or tabs. Sort keys alphabetically when you want a stable diff. Minify on this page when you only need a compact payload — you do not have to open JSON Minifier unless you prefer that URL. Invalid JSON shows a syntax error with line and column instead of silently keeping stale output.
Worked example: a one-line API body becomes a readable tree so you can see nested fields. Sorting keys helps git diffs when two dumps differ only by key order. Trailing commas, unquoted keys, and single quotes are not JSON; the error banner is the point, not a bug.
This is not a schema validator (use JSON Validator for validity without rewriting). It is not JSON Compare (two documents). JSON → TypeScript is Convert to on the same persist key. Payloads never leave this tab. Keep production secrets off shared machines. Bookmark this URL if you pretty-print JSON often; there is nothing extra to install.
Related JSON tools
JSON Minifier
Remove whitespace from valid JSON. Type or paste below — the result updates as you type.
JSON → TypeScript
Generate TypeScript interfaces from a JSON object or array. The result updates as you type.
JSON Validator
Validate and format your JSON. Check for syntax errors and view detailed error information. The result updates as you type — nothing is uploaded.
YAML ↔ JSON Converter
Convert YAML documents to JSON, or JSON values to YAML. The result updates as you type.
Fake JSON Generator
Generate sample JSON users, products, or API responses for mocks. The payload appears as soon as you pick a sample.
JSON Formatter examples
Format
Sort keys
Minify
JSON tools
| Tool | Example | Typical use |
|---|---|---|
| Format | { "hello": "world" } | Pretty-print, reviews, and readable diffs |
| Minify | {"hello":"world"} | Compact payloads, logs, and copy-paste |
| TypeScript | export interface Root { … } | Interfaces for API samples and mocks |
JSON Formatter FAQ
It pretty-prints JSON as you type, with 2-space, 4-space, or tab indent. You can sort keys alphabetically or minify on the same page.
A syntax error appears under the output with the line and column when the parser reports them. Fix the input and the formatted JSON updates again. Formatting still runs locally in your browser.
Yes. Turn on Minify JSON in the formatter toolbar. You can also open the dedicated JSON Minifier tool if you only need compression.
Yes. Use Copy Code on the prettified output pane. Formatting runs locally in your browser — nothing is uploaded.