Ambimat GroupAmbimatAmbiSecureV2XeSIM & eUICCAmbiAutomationEngineering BlogAhmedabad · India · Est. 1982
Data utility

JSON Formatter and Minifier

Pretty-print, minify, and optionally sort keys in JSON — right in your browser. Pick 2-space, 4-space, or tab indentation, and get a precise line and column when the input fails to parse.

Client-side2 / 4 / tab indentSort keys

How to use this tool

What it does

Pretty-prints and minifies JSON with syntax validation.

When to use it

Use it to make a compact API response or WebAuthn options object readable, or to minify one before embedding it.

Worked example

Paste a one-line PublicKeyCredentialCreationOptions blob and read it back indented and structured.

Input

Result

Paste JSON to format it.
All parsing and formatting runs locally in your browser. Nothing is uploaded — safe for JSON containing tokens or keys.

What this tool does

This is a JSON formatter: it reads a JSON document, parses it once with the browser's native JSON.parse, and re-emits it the way you ask. Pretty-print produces readable, indented output; minify collapses it to the smallest equivalent string; and the optional sort-keys pass reorders object keys recursively so two payloads diff cleanly. Because every mode parses first, the tool doubles as a fast validity gate — if the input is not well-formed JSON, you get a precise error instead of mangled output.

It is deliberately distinct from the JSON validator. The validator is about checking a document against a schema and reporting structural findings; this page is about transforming the output you already have. Reach for this tool when you have a blob of minified JSON from a network trace and want to read it, or a hand-edited config that needs to be normalised before committing.

When to use it

Pretty-print when you have captured a one-line response body — from an API log, a smart-card management server, or a WebAuthn ceremony trace — and need to see its shape. Minify before embedding JSON in a constrained field, a QR payload, or a URL where every byte counts. Sort keys before diffing two configuration files whose authors emitted fields in different orders, so the diff shows real changes rather than reordering noise. For binary-adjacent formats, the CBOR decoder turns a compact binary encoding into JSON you can then format here.

Input and output

The input is any valid JSON value: an object, an array, a string, a number, a boolean, or null. Whitespace, indentation, and line endings in the input are irrelevant — the parser ignores them, so you can paste minified or already-indented text. The output reflects your chosen mode and indent. Pretty-print uses your indent setting (two spaces, four spaces, or a literal tab) for every nesting level; minify ignores the indent setting entirely and emits no optional whitespace. The decoded value is preserved exactly: strings, number precision within IEEE-754 limits, and key sets are unchanged — only layout and, optionally, object-key order change.

When the input cannot be parsed, the result panel shows a parse error with a line and column. The position is taken from the offset the browser reports for the syntax error; the tool walks the text to that offset, counting newlines to give a one-based line and column. If the browser does not supply an offset, the raw engine message is shown so you still know what broke.

Common mistakes

Related tools

JSON Validator

Check a document against a JSON Schema and report structural findings.

Open JSON Validator →

JSON Bin Builder

Compose and inspect binary-bearing JSON payloads field by field.

Open JSON Bin Builder →

CBOR Decoder

Turn a compact CBOR binary encoding into JSON you can format here.

Open CBOR Decoder →

Frequently asked questions

What is the difference between pretty-printing and minifying JSON?

Pretty-printing re-emits the JSON with newlines and indentation so a human can read the structure. Minifying strips every optional space and newline to produce the smallest equivalent payload for transport or storage. Both parse the input first, so both also act as a validity check: invalid JSON cannot be formatted at all. The decoded value is identical either way.

Does sorting keys change the meaning of my JSON?

No. JSON objects are unordered by specification, so reordering keys produces an equivalent document. Sorting keys recursively gives a deterministic, canonical-looking output that is easy to diff across two payloads or commits. It does not reorder array elements, because arrays are ordered and their order is significant.

How does the line and column in an error get calculated?

The browser's JSON.parse reports a character position for a syntax error. This tool reads that position from the error message and walks the input up to that offset, counting newlines to derive a one-based line number and the column within that line. When a position is not available it falls back to the raw browser message so you still see why parsing failed.

Should I use this tool or the JSON validator?

Use this formatter when you want to transform output — pretty-print, minify, or sort keys — and copy or download the result. Use the JSON validator when you need to check a document against a JSON Schema or report multiple structural findings. Both run entirely in your browser.

Does anything I paste leave my browser?

No. All parsing, formatting, minifying, and key sorting run locally in JavaScript on this page. Nothing is uploaded, logged, or sent to a server, so it is safe to format JSON that contains tokens, keys, or other sensitive fields.