JSON Formatter

JSON Formatter

Pretty-print JSON with indentation, optional key sorting, and minify. The result updates as you type.

Free
No signup
Instant
Private
Input
0 words • 0 characters • 0 without spaces • 0 lines
Indentation
Style
Keys
Convert to
Output
0 words • 0 characters • 0 without spaces • 0 lines

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

  1. Paste JSON in the input box.

  2. Pick indent (2, 4, or tabs), sort keys, or minify — the result updates as you type.

  3. Use Convert to to open JSON Minifier or JSON → TypeScript with the same JSON.

  4. 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.

Learn more about privacy →

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 Formatter examples

Format

Input
{ "z": 1, "hello": "world" }
Output
{ "z": 1, "hello": "world" }

Sort keys

Input
{ "z": 1, "hello": "world" }
Output
{ "hello": "world", "z": 1 }

Minify

Input
{ "z": 1, "hello": "world" }
Output
{"z":1,"hello":"world"}

JSON tools

ToolExampleTypical use
Format{ "hello": "world" }Pretty-print, reviews, and readable diffs
Minify{"hello":"world"}Compact payloads, logs, and copy-paste
TypeScriptexport 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.