JSON Formatter & Validator
Format, validate, and minify JSON in your browser. Pretty-print with 2/4 spaces or tabs, or minify. Nothing uploaded.
Pure browser JavaScript (uses the built-in JSON parser).
How to use this tool
- Paste JSON.
- Click Format (validates + pretty-prints) or Minify.
- Copy or Download the result.
Format, validate, and minify JSON in your browser. Pretty-print with 2/4 spaces or tabs, or minify. Nothing uploaded.
How it works
This tool accepts raw JSON text and either formats it with configurable indentation (pretty-print) or collapses it to the smallest possible representation (minify). It also validates the JSON as you paste it, highlighting any syntax errors with their line and character position.
Pretty-printing adds consistent indentation and line breaks, making nested structures human-readable. Minification removes all whitespace outside of string values, reducing file size for transmission. Both operations are performed entirely client-side — your JSON data never leaves your browser.
Use this tool when debugging API responses, cleaning up configuration files, preparing JSON for storage where size matters, or quickly checking whether a JSON string is syntactically valid.
Worked examples
Pretty-print a minified API response
- Paste the minified JSON string into the input area.
- Select '2 spaces' or '4 spaces' indentation.
- Click 'Format'.
- Copy the formatted output from the result panel.
A single-line JSON blob becomes a readable multi-line structure with nested keys indented consistently, making it easy to find and inspect specific fields.
Validate a JSON config file before deploying
- Paste the contents of your config file into the input.
- Any syntax error appears immediately with a line number.
- Fix the error (e.g., a trailing comma or mismatched brace).
- Re-paste and confirm no errors are shown.
A missing closing bracket on line 23 is identified before deployment, preventing a runtime configuration error.
Common mistakes to avoid
- Using trailing commas after the last element in an array or object — this is valid in JavaScript but not in strict JSON.
- Using single quotes instead of double quotes for strings — JSON requires double quotes around all string keys and values.
- Pasting a JavaScript object literal (with unquoted keys) and expecting it to validate as JSON.
Key terms
- Pretty-print
- Formatting JSON with indentation and newlines to make the structure readable by humans.
- Minify
- Removing all non-essential whitespace from JSON to produce the smallest valid string, used to reduce payload size.
- JSON syntax error
- A violation of the JSON specification, such as a trailing comma, single-quoted string, undefined value, or unmatched bracket.
Frequently asked questions
- Is my JSON sent anywhere?
- No — it is parsed locally by your browser.