Skip to content
Swizztool

JSON Formatter & Validator

Format JSON payloads with 2-space, 4-space, or tab indentation. Includes minification and syntax validation with line and column error indicators.

Output

Your text 256 chars · 1 line

Result ✓ Valid JSON

How to use JSON Formatter & Validator

  1. Paste your raw JSON string into the editor.
  2. Select an indentation mode (2 spaces, 4 spaces, or tabs) or click Minify.
  3. Review syntax validation errors with exact line and column numbers.
  4. Copy or download the formatted JSON file.

About JSON Formatter & Validator

Format, validate, and minify JSON in your browser. Paste a payload and it is pretty-printed instantly with 2 spaces, 4 spaces, or tabs. If the JSON is invalid, you see the error and where it happened instead of a broken result.

Related tools: Base64 Encoder / Decoder, URL Encoder / Decoder, JWT Decoder, Regex Tester

Formatting and validation

The formatter parses your JSON exactly as a browser or server would, then prints it with consistent indentation. Because it parses first, it also works as a validator: a missing comma, a trailing comma, or single quotes around a key produce a clear error with the line and column where parsing failed.

Minify does the reverse. It removes all whitespace to make the smallest valid JSON, which is useful for config values, environment variables, and request bodies where size or a single line matters.

Common JSON mistakes

JSON is stricter than JavaScript. Keys and strings need double quotes, trailing commas are not allowed, and comments are not part of the format. Values like undefined, NaN, and functions are invalid too.

If you paste data copied from JavaScript code and get an error, check for single quotes and trailing commas first; they cause most failures.

Common uses

Reading API responses
Turn a one-line API response into an indented structure you can scan.
Validating config files
Check package.json, tsconfig, or app settings for syntax errors before deploying.
Minifying payloads
Shrink JSON for a request body, environment variable, or test fixture.
Sharing data
Clean up JSON before pasting it into a ticket, doc, or chat.

Questions about JSON Formatter & Validator

Is my JSON payload sent to a server?
No. All formatting, minification, and parsing execute locally inside your browser memory.
How does the validator indicate syntax errors?
When invalid JSON is detected, the tool pinpoints the exact line number and character column where parsing failed.
Why does my JSON fail with a trailing comma?
Trailing commas are valid in JavaScript but not in JSON. Remove the comma after the last item in an object or array.
Can it handle large files?
Yes, within your browser's memory. Payloads of several megabytes format in about a second on a typical laptop.
Does formatting change my data?
No. Only whitespace changes. Keys, values, and order stay exactly the same.

Comments

Questions, ideas, or a bug in JSON Formatter & Validator? Let us know.