LocalFirstTools.com — data tools that never leave your device
No upload — everything runs on your device

Pretty-print JSON

Pretty-printing parses JSON and re-serializes it with two-space indentation and one key per line, so structure that was invisible on a single line becomes readable. The data is untouched — only inter-token whitespace changes, which RFC 8259 defines as meaningless.

Readability has a measurable byte cost: across the 26-document sample corpus in scripts/fixtures/ (minified with JSON.stringify, then re-indented at 2 spaces by this page's own formatter), pretty-printing grew documents by a median 37.2% (min 22.6%, max 118.6%). The 118.6% outlier is a deeply nested Kubernetes deployment — nesting depth, not document size, drives the overhead.

Input
Output

Formatted JSON will appear here.

Valid JSON10 lines151 BValidated locally

When it goes wrong

Invalid input produces no output; the status bar shows the parser's message with the exact line and column and highlights the offending line in the gutter. The most common culprits are a trailing comma, single quotes, or an HTML error page pasted where JSON should be (that one reads “Unexpected token <” at line 1, column 1).

When to use this

Pretty-print whenever a human needs to read the document: API responses from a terminal, log payloads, config blobs from a database column.

This page is a focused view of theJSON Formatter & Validator, which has the full set of options.

Frequently asked questions

What indentation does the formatter use?

Two spaces, the dominant convention in web tooling and what jq and Prettier emit by default. The data itself is unchanged.

Does key order change when pretty-printing?

Not unless you enable the Sort keys toggle. By default keys are emitted in the order the parser encountered them.

Can I pretty-print a JSON file from disk?

Yes — drop a .json file onto the input pane or use the Upload button. The file is read locally with the FileReader API and never leaves your device.