JSON Formatter & Validator
Format, beautify, and validate JSON instantly. Minify for production or pretty-print for readability. Error highlighting included.
How to Use
- 1
Paste your JSON
Paste raw or minified JSON into the input area.
- 2
Format or minify
Click Format to pretty-print with indentation, or Minify to compress it.
- 3
Copy the result
Click Copy to copy the formatted JSON to your clipboard.
How It Works
This tool parses your JSON, checks it's syntactically valid, and re-prints it either indented for readability or minified for production — all inside your browser, so nothing you paste is sent anywhere.
What "valid JSON" actually requires
JSON is stricter than JavaScript object literals: property names must be in double quotes (not single quotes or unquoted), there can be no trailing comma after the last item in an object or array, and values must be strings, numbers, booleans, null, objects, or arrays — no functions, comments, or undefined.
Pretty-print vs minify
Pretty-printing adds consistent indentation and line breaks so nested structures are easy to read and debug. Minifying strips all non-essential whitespace, producing the smallest possible payload — useful for production APIs and config files where transfer size matters more than human readability.
Examples
A common invalid-JSON mistake
`{ name: "Alex", age: 30, }` fails validation for two reasons: the key `name` isn't wrapper in double quotes, and there's a trailing comma after `30`. The validator highlights exactly where parsing breaks so you don't have to eyeball the whole document.
Debugging an API response
Pasting a minified API response and clicking pretty-print turns an unreadable single line into properly indented, nested JSON — making it far faster to find the specific field you're looking for.
Common Use Cases
- Debugging malformed JSON returned by an API before it breaks your application
- Formatting config files (package.json, tsconfig.json, etc.) for readability during manual edits
- Minifying JSON payloads before shipping them to reduce transfer size
- Validating hand-written JSON (e.g. test fixtures or sample payloads) before using them in code
Tips
- If validation fails, check for the three most common culprits first: single quotes instead of double quotes, a trailing comma, or an unescaped quote inside a string value.
- JSON does not support comments — if you need to document a config file, most tools that consume JSON5 or JSONC will accept comments, but strict JSON parsers will reject them.
- Minify before sending JSON over a network in production, and keep the pretty-printed version only in your source/version control for readability during development.
Frequently Asked Questions
Related Tools
Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 strings back to plain text. Supports Unicode and URL-safe Base64.
URL Encoder / Decoder
Encode special characters in URLs or decode percent-encoded URLs. Handles full URLs and individual query parameters.
UUID Generator
Generate cryptographically secure UUID v4 identifiers. Generate up to 20 at once. Copy individually or all at once.