JSON
JSON Formatter / Minify / Validator
Format (2-space indent), minify, and validate JSON right in your browser.
JSON Formatter turns any JSON into a readable, indented form, compresses it into a single compact line, or checks it for syntax errors. Everything runs in your browser — nothing you paste is sent anywhere.
How to use it
- Format: paste JSON into the input — a 2-space indented result appears immediately.
- Minify: switch to Minify mode to get compact JSON with no whitespace, ready to embed in code or send over the network.
- Validate: if the JSON is invalid, the tool points to the exact line and character where the syntax error occurs.
Common uses
- Reading an API response that arrived as one long unbroken line.
- Checking configuration files (package.json, tsconfig.json, etc.) before a commit.
- Minifying JSON before pasting it into an environment variable or a one-line config.
Things to keep in mind
Formatting never changes data types or key order — only the whitespace and line breaks around values.
Valid JSON doesn't allow trailing commas, comments, or single quotes — if your input has those, run it through JSON Repair first.
Article about this tool: JSON Formatter: formatting, minifying, and validating
Frequently asked questions
What is the difference between Format and Minify?
Format adds 2-space indentation for readability, while Minify strips all unnecessary whitespace and line breaks to shrink the file size. Both modes only reformat the structure — the actual characters inside string values are never touched.
Is it safe to paste data from a real project here?
Yes — formatting, minifying, and validation all happen entirely in your browser via JavaScript. Nothing is uploaded to any server.
Why does JSON that looks valid still fail validation?
The most common cause is a trailing comma before a closing bracket or brace. Some programming languages allow that, but the JSON standard does not, so the parser reports an error right at that spot.
How is JSON5 or JSONC different from standard JSON?
They are extensions that additionally allow comments, trailing commas, and unquoted keys. A strict JSON validator (like this tool) correctly rejects such text — it needs a separate parser that explicitly supports JSON5/JSONC.
Does formatting change the data types, such as numbers?
No, formatting and minifying only rearrange the whitespace and line breaks around values. Numbers, strings, booleans, and null are left exactly as they were.