ToolGuest
Global · Tier-1 optimized
✓2, 4 or tab indent · tree view · nothing uploaded

JSON Pretty Print for Any Payload

Turn a single line of minified JSON into an indented, scannable document. Pretty printing keeps every value and changes only whitespace, so what you read is what the API receives.

One click to indent Sort keys A→Z Tree view No uploads
0 B input 0 B output 0% vs input — top level 0 values 0 keys 0 levels deep
Input JSON

Drop a .json file anywhere in this pane — it is read with FileReader in this tab.

0 lines · 0 characters · 0 B
Formatted output
0 lines · 0 characters · 0 B

Parsed with the native JSON.parse in your browser. Zero network requests, no upload endpoint.

AI summary

What does ToolGuest JSON Pretty Print do? ToolGuest JSON Pretty Print re-indents a minified JSON document in the browser with 2-space, 4-space or tab indentation, optional A→Z key sorting and a collapsible tree view. It preserves every value, reports syntax errors by line and column, and never uploads the payload, so a production response stays on your machine.

Complete your JSON debugging workflow Diff Checker Base64 Encoder Markdown to HTML
How it works

Pretty print a JSON document in three steps

  1. 1

    Drop in the minified line

    Paste a compact response, or open the .json file it came from. The sample on this page is already minified so the difference is visible.

  2. 2

    Pick an indent

    Two spaces is the default, four spaces suits Java and PHP codebases, and a tab matches Go. Switch to the tree when you would rather collapse than scroll.

  3. 3

    Copy, download or inspect

    Copy the indented text, download a .json file, or read the telemetry chips for input size, output size and nesting depth.

Guide · whitespace

What pretty printing changes, and what it deliberately leaves alone

Pretty printing inserts newlines and indentation between tokens. It does not reorder members, rewrite strings or convert types, so a field that arrived as the string "null" stays a string. The only exceptions come from the parser itself: numbers are normalised, and a duplicate key keeps its last value.

That restraint is what makes the output trustworthy in a review. When a formatted payload differs from the original beyond whitespace, the difference is a real change in the data, not a side effect of the tool. Compare the two documents in the Diff Checker to see exactly which values moved.

Guide · reading

Pretty print or minify: choosing the right shape for the job

Minified JSON is for the wire. Removing indentation typically cuts a pretty-printed payload by 20 to 40 percent, which is worth doing for request bodies, queue messages and anything billed by bytes. Pretty-printed JSON is for humans: pull requests, incident notes, schema examples and teaching material.

A practical loop is to pretty print while you debug, then minify before you send. Both directions run in the same workspace, so the payload never leaves the tab and the byte counts update as you switch, which makes the size cost of readability visible instead of theoretical.

Indent settings

Pretty print options and when each one helps

The indentation you choose is a convention, not a correctness question. The middle column is what the setting changes in the output; the right column is where that shape earns its keep.

SettingWhat it changesWhen to use it
2 spacesOne level of nesting becomes two spacesThe default for JavaScript, TypeScript, Python and most repositories
4 spacesOne level of nesting becomes four spacesJava, PHP and C# codebases, plus teams that follow a wider house style
TabOne level of nesting becomes a tab characterGo, Makefiles and editors where each developer sets their own tab width
Sort keys A→ZMembers are written in alphabetical order at every depthBefore a diff or a checksum, so moved keys stop looking like edits
Tree viewNesting becomes collapsible rows with types and countsDeep responses where scrolling a long document is slower than collapsing it
FAQ

JSON pretty print: questions

What exactly does pretty printing do to a JSON document?

It re-serialises the parsed document with newlines and indentation between tokens, so each member and array element sits on its own line. Values are untouched. Strings, numbers, booleans and null keep their types, and arrays keep their order, which is why the indented copy is safe to hand to another engineer.

How do I pretty print a minified response without an editor?

Paste the single line into the editor here and the output pane redraws already indented. There is nothing to install and no file to save first. The formatter uses the browser's own parser, so the result matches what your application will read at runtime.

Is pretty-printed JSON larger, and does that matter?

Yes, indentation usually adds 20 to 40 percent to the byte count of the same data. That is irrelevant for reading and material for transport: request bodies, queue payloads and anything measured against a size limit should be minified after you finish reading them, which this workspace does in one click.

Can I pretty print JSON with sorted keys for a stable diff?

Yes. Switch on Sort keys A→Z and every object is rewritten alphabetically at every depth before the output is produced. Arrays keep their original order, because their position carries meaning. Sort both documents the same way and a text diff shows only values that genuinely changed.

How deep can pretty printing go before the output gets unreadable?

Indentation helps until roughly eight to ten levels, after which long lines of leading spaces hide the structure. At that point the tree view is faster: it collapses branches and shows key counts, so you can walk a nested API response without scrolling past the parts you already understood.

The cluster

All JSON Formatter, Validator & Developer Tools

Ten pages, one client-side engine. Every tool formats, validates, minifies, sorts keys and lints in the same workspace, and each page opens with the mode its name promises — a validator that lands on errors, a minifier that shows the bytes saved, a pretty printer that indents a single line, a linter that repairs common syntax, a viewer that starts in the tree.

Last updated ·Reviewed by the ToolGuest editorial team