JSON Formatter / Validator
How to Format JSON Online
Copy your raw, minified, or unformatted JSON data and paste it into the input area above.
Click Prettify to add indentation and line breaks for readability, or Minify to compress JSON into a single line for production use.
The formatted or minified JSON is displayed instantly. Click Copy to copy it to your clipboard.
What Prettify, Minify and Validate do
- Prettify rewrites the JSON with one item per line and an indentation of two spaces, so the structure can be read.
- Minify removes every space and line break that is not inside a string and tells you how many percent smaller the result is. The data is unchanged.
- Validate checks the syntax without changing anything, and reports the number of top-level keys or items.
Why valid-looking JSON is rejected
JSON is stricter than the JavaScript it grew out of. These are the errors we see most:
Common JSON mistakes
| Not valid | Valid | Rule |
|---|---|---|
{"a": 1,} | {"a": 1} | No comma after the last item |
{'a': 'x'} | {"a": "x"} | Double quotes only |
{a: 1} | {"a": 1} | Keys must be in quotes |
{"a": 1} // note | {"a": 1} | Comments are not allowed |
{"ok": True} | {"ok": true} | true, false, null in lower case |
{"n": 01} | {"n": 1} | No leading zeros in numbers |
The error message gives the position where parsing stopped. The real mistake is usually just before it — a missing comma or quote on the previous line.
Two things that change when JSON is reformatted
- Very large numbers lose digits. Numbers are read the way browsers read them, which is exact only up to 9,007,199,254,740,991. An ID such as
12345678901234567890comes out as12345678901234567000. If your data has long numeric IDs, check them after formatting — or better, store such IDs as strings. - Duplicate keys are merged. If an object contains the same key twice, only the last value is kept. Keys that look like whole numbers are also moved to the front of their object.
Everything else — strings, nesting, order of normal keys, Unicode text — comes out exactly as it went in. The work is done in your browser; API responses and configuration files with secrets are not sent to our server.
Frequently Asked Questions
Does this tool validate JSON?
Yes. If your JSON is invalid (missing brackets, trailing commas, unquoted keys), the tool will show a syntax error message identifying the problem.
What is the difference between prettify and minify?
Prettify adds indentation and line breaks to make JSON readable. Minify removes all whitespace to produce the smallest possible file — useful for production APIs and configuration.
Can it handle large JSON files?
The tool runs in your browser, so it can handle JSON data up to several megabytes. For extremely large files (50MB+), a desktop tool may be more appropriate.
Is my JSON data stored anywhere?
No. All processing happens in your browser. Your JSON data never leaves your device.