Practical guide
How to format, validate and minify JSON
An API response can be valid but difficult to read. This guide shows how to make it readable without changing number tokens or content, and how to distinguish syntax errors from an unexpected structure.
Choose one of four modes
Paste one JSON document, choose two-space or four-space indentation, minification or validation only, then select “Process”. Indentation makes nested structures easier to read. Minification removes unnecessary whitespace outside string literals; spaces inside values such as “Nowy Sącz” remain untouched.
Validation returns a status rather than transformed content. Its copy button copies that message, not the document. Other modes copy JSON text without an extra label. Keep the original outside the tool if you need to compare its layout or return to a previous version.
Check a simple example
The document below contains a city and a number. Minification does not reorder members. Indentation adds line breaks and structural spacing. Quoted text stays unchanged even when it contains multiple spaces, an escaped slash or a Unicode escape sequence.
Do not remove spaces with a simple editor replacement: that would alter string contents too. Select minification, inspect the preview, then copy into a file. The tool does not save or submit that file for you.
| Input | Output |
|---|---|
| { "city": "Nowy Sącz", "amount": 1.00 } | {"city":"Nowy Sącz","amount":1.00} |
Fix syntax without guessing data
Member names and strings need double quotes. Comments, trailing commas, single quotes, NaN and Infinity are unsupported. JavaScript code, JSON5, a BOM or multiple JSON Lines documents do not pass this parser. Do not invent a missing value merely to make an error disappear.
Syntax errors use one-based line and column positions; columns count UTF-16 units, not visual characters. Inspect the preceding token as well: a missing separator may only become apparent at the next member. A standalone number, string, true, false or null can be a document, but an empty input cannot.
Large numbers retain their original spelling
The formatter preserves tokens such as 9007199254740993, 1.00, -0 and 1e400 without converting them to JavaScript numbers. It neither rounds them nor replaces them with null. Member order and string escape spelling are retained too, so this is not canonicalization for signing or identical byte representations.
A receiving application may subsequently parse a large number with lost precision. Check its parser; preserving spelling here cannot guarantee preservation everywhere. For identifiers or monetary amounts, follow the API’s required type and rules instead of arbitrarily converting a number into a string.
Validation scope and limits
Input is capped at 50,000 UTF-16 units, nesting at 64 levels, values at 10,000 and text output at 500,000 units. Indentation can substantially enlarge output. Duplicate decoded member names and unpaired Unicode surrogates are rejected under an intentionally narrower interoperability profile, not a claim that the RFC forbids every such representation.
Valid syntax does not confirm required fields, a price’s type or a recipient’s permissions. There is no JSON Schema or business-rule validation. A limit breach does not produce partial success. Use a smaller complete document rather than cutting through a value or array.
Privacy, copying and reset
Paste only the necessary, anonymized passage. Input and output are processed in the browser without submission to analytics or localStorage/sessionStorage history. Visiting the page still connects to hosting. Local processing cannot protect against browser extensions, an insecure device or accidental clipboard sharing.
Editing a field clears the previous result; run the tool again after a correction. Copying is a separate action. Reset clears the form and restores options but cannot remove earlier clipboard copies, printouts or documents. Report issues with a short synthetic example and expected output, not a complete production API response.
Frequently asked questions
Does minification compress a file?
It removes unnecessary whitespace outside strings. It is not ZIP/gzip compression or a promise of a particular byte saving.
Does formatting sort members?
No. Member order, number tokens and string escape spelling are preserved. JSON is not canonicalized.
Why are duplicate names rejected?
Receivers can handle them differently. The tool rejects rather than overwrites or guesses, including names equal after escape decoding.
Does reset remove clipboard text?
No. It clears the form, not user-created copies. Remove those separately if they contain sensitive data.
Sources and scope
This guide explains the tool and its limits, not compliance with an API, JSON Schema or business rules. Use examples without confidential data and verify output in its destination system. Limits and additional rejections are implementation choices, not universal JSON requirements.
Tools covered by this guide
JSON formatter and validator
Check JSON syntax, add indentation or remove unnecessary whitespace without rounding numbers.
JSON comparison
Compare two JSON documents and find added, removed or changed members using JSON Pointer paths.
JSON escape and unescape
Turn plain text into a quoted JSON string literal or decode one layer of JSON escape sequences.