Tools / JSON Formatter and Validator
JSON Formatter and Validator
Free online JSON formatter, minifier and validator. Paste API responses or config files, then format for readability or minify for production. Everything runs in your browser, so nothing is uploaded.
Most JSON problems are one of two things: a document too dense to read, or a document that will not parse for a reason the error message does not make obvious. Formatting solves the first. The notes below cover the second, because JSON is a good deal stricter than the JavaScript it looks like.
How to use it
- Paste the JSON into the input box. An API response, a config file, a log line, anything that should parse.
- Press Format to rewrite it with consistent indentation, or Minify to strip every byte of whitespace for production.
- If it will not parse, read the error message. It names the character position, which is where the parser gave up rather than always where the mistake is.
- Copy the result out. Nothing is uploaded, so the payload never leaves the browser tab.
What people use it for
Reading an API response that arrived as one line
Most APIs return minified JSON, and a deeply nested response is unreadable until it is indented. Formatting is the fastest way to see the shape of something before writing the code that consumes it.
Finding the syntax error in a config file
A tsconfig, a package.json or a CI workflow that will not load usually has one bad character. Tooling often reports this as an unhelpful "unexpected token", while a validator names the position directly.
Shrinking a payload before shipping it
Minifying removes whitespace only, so values and structure are untouched. On a large seed file or an embedded config the saving is real, and it compresses further over the wire.
Checking what a webhook actually sent
Paste the raw body from your logs. If it parses, the problem is in your handler. If it does not, the sender is at fault, and you have the character position to quote back to them.
Notes and limits
- Everything runs in your browser. The JSON is never uploaded, so you can paste a response containing customer data without it reaching a server. It does stay in your browser history and clipboard, so treat live credentials accordingly.
- JSON is stricter than JavaScript. Trailing commas, single quotes, unquoted keys, comments and NaN are all valid JS and all invalid JSON. This is the single most common reason a paste fails to parse.
- JSONC and JSON5 are different formats. A tsconfig.json with comments in it is JSONC, and it will not validate here even though TypeScript accepts it.
- The error position is where parsing failed, not always where you made the mistake. A missing closing brace is reported at the end of the document, because that is the first point the parser can be certain something is wrong.
- Key order is preserved on format, but JSON objects are unordered by specification. Do not rely on the order surviving a round trip through another tool.
- Very large documents are limited by browser memory. Files in the low megabytes are fine; a multi-hundred-megabyte export is a job for jq.
Frequently asked questions
What does a JSON formatter do?
It parses your JSON and rewrites it with consistent indentation so you can read nested objects and arrays more easily.
Will minifying JSON break my data?
No. Minification only removes whitespace. The parsed values and structure stay the same.
Why does validation fail?
Common causes are trailing commas, single quotes instead of double quotes, or missing brackets. The error message points to the parse issue.
Why is my valid JavaScript object rejected?
JSON is a stricter subset. Unquoted keys, single quotes, trailing commas and comments are all legal JavaScript and all invalid JSON.
Can I format a tsconfig.json with comments?
No. A file with comments is JSONC, not JSON. Strip the comments first or use a JSONC-aware parser.
Let's build something you're proud of
I help businesses launch, optimize and maintain their online presence, from code to SEO.
Let's talkRelated tools
CSS Minifier and Beautifier
Minify CSS to reduce file size or beautify CSS for readable formatting. Free online CSS tool for developers.
HTML Minifier and Beautifier
Minify or beautify HTML online. Remove whitespace and comments to reduce file size, or format code for readability.
Image Resizer and Compressor
Free online image resizer and compressor. Resize photos, convert to WebP or JPEG and shrink file size in your browser, with no upload.
robots.txt Generator
Free robots.txt generator. Build user-agent groups with allow and disallow rules, add a sitemap, block AI crawlers and copy the file.
Cron Expression Explainer
Free cron expression explainer. Translate a five-field crontab line into plain English and preview the next scheduled runs in your browser.
htaccess Redirect Generator
Free .htaccess redirect generator for Apache and cPanel. Build 301 and 302 mod_rewrite rules, force HTTPS and pick a canonical www host.