JSON Formatter / Validator
Format, minify, and validate JSON with 2-space, 4-space, or tab indentation - all in your browser.
- Free, no account
- No watermark
- No usage limit
About the JSON Formatter / Validator
Pretty-printing JSON is a solved problem. Every formatter on the internet takes a minified blob and adds line breaks, and they all do it about equally well, so that isn't really why you'd pick one over another. The moments that actually cost you time are different. Your JSON won't parse and the formatter just refuses, throwing a cryptic error that points a couple characters past the real mistake, so you're stuck counting brackets by hand. Or the response is four thousand lines and you need one field buried in the middle, which is a different problem entirely. This tool has a button for each. Repair fixes broken JSON so you stop hunting for the missing comma, and the JSONPath filter pulls the field you want out of a giant payload without scrolling. Format, minify, and validate are here too, and all of it runs in your browser, so the tokens and customer data you paste never leave your machine.
How to use
- Paste your JSON into the input box. Minified, pretty-printed, half-edited, it doesn't matter. The tool reads all of them.
- Hit Format to pretty-print, or Minify to crush it back onto one line. Pick 2 spaces, 4 spaces, or tabs first if you care about the indent style.
- If it won't parse, hit Repair. It fixes the usual breakage and rewrites your input in place so you can see what it changed, then formats the result.
- Once you have valid JSON, a JSONPath box appears. Type an expression like
$.tools[*]to filter down to just the part you want. Leave it blank for the whole document. - Flip the output between Text and Tree. Tree view lets you collapse and expand branches, which beats scrolling through a massive object to find one node.
- Copy the output, Download it as a
.jsonfile, or Clear both boxes to start over. Load sample drops in an example if you just want to poke at it.
Repair does the comma-hunting for you
Most formatters have one response to malformed JSON, which is to stop and complain. You get a message like Unexpected token } in JSON at position 214 and then you're on your own to go hunting. Repair is there so you do not have to. It takes the mangled text, applies the fixes people actually need, and hands back clean JSON.
Here's what it handles: single quotes where JSON wants double, the trailing comma you left after deleting the last property, // line comments and /* block comments */ that strict JSON rejects, keys left unquoted the way JavaScript allows, and a handful of other common messes. It writes the corrected version straight back into the input box, so you're not just told it worked, you can read the change yourself and decide whether you agree with it.
One honest caveat. Repair is inferring what you meant, and inference can guess wrong. If a value is genuinely missing or the structure is truly ambiguous, it makes a reasonable call, and that call might not be the one you had in mind. So glance at the result before you trust it. For the everyday case, a config a human hand-edited, a chunk of JS-flavored pseudo-JSON, a copy-paste that dropped its quotes, it just works and saves you the tedium.
Pull one field out of a giant payload
JSONPath is the thing a plain formatter doesn't give you. Once your JSON is valid, a filter box shows up, and you can run a query against the whole document live. Type, and the output updates as you go.
A few expressions cover most of what you'd reach for:
$.tools[*]grabs every item in the top-leveltoolsarray.$..namefinds everynamekey anywhere in the document, however deep it's nested. That recursive one is the workhorse when you don't even know which level the field lives on.$[?(@.free==true)]filters an array down to only the objects wherefreeis true.
The output box then shows only the slice you asked for, formatted with your chosen indent, so you can select it right there and copy it out. For a big response where you only care about the email addresses or the IDs, this turns a long scroll-hunt into one line. If you'd rather work visually, the Tree view collapses the whole object so you can open just the branch you're chasing.
Why the error position is usually a little off
When JSON won't parse, the tool shows the exact message your browser's parser produced, position and all. Worth knowing how to read it. That position is where the parser gave up, not always where you went wrong. A missing comma gets reported at the start of the next token, because that's the first thing the parser couldn't reconcile, so the real fix is usually a line or two above where the message points. Nine times out of ten the culprit is a stray or missing comma, a quote that never closed, or a mismatched bracket. And if squinting at positions feels like more trouble than it's worth, that's what Repair is for.
Format, minify, and staying local
Format and Minify are the two directions, and they undo each other cleanly. Pretty-print adds the whitespace back so a human can read and diff the structure, minify strips every spare byte so the payload travels light. Both produce identical data, only the whitespace moves, so bounce between them as often as you like with zero risk to the content. Need the data in a different shape entirely? The JSON to CSV and JSON to YAML converters take it from there.
Indent is your call, purely cosmetic. Two spaces is the web default and keeps deep nesting on screen, four spaces spreads it out, tabs let each editor render the width it prefers. It only touches the pretty-printed output, never the data.
All of this happens in your browser with the same JSON engine the browser already ships. Nothing you paste is uploaded, logged, or saved, which matters when the thing you're debugging is an API response full of auth tokens or a customer record. Plenty of cloud formatters send your paste to their server, and a few store it at a public URL that then gets indexed. This one can't, there's no server in the loop. Open your Network tab and paste something, you'll see zero outgoing requests. Close the tab and it's gone.
Frequently asked questions
Does the JSONPath filter change my JSON?
No, it's a read-only view. The filter only decides which parts of the parsed document show in the output box. Your input stays exactly as you pasted it, and clearing the filter brings the whole thing back. It's a lens over the data, not an edit. To pull just that slice out, select it from the output box yourself. The Copy and Download buttons always give you the full formatted document, filter or not.
What JSONPath syntax can I use?
The common set. Dot and bracket notation for keys, wildcards with *, recursive descent with .. to search every level, array slices like $.items[0:3], and filter expressions such as $[?(@.price > 100)]. Type something the engine can't parse and it flags the error inline, still showing the full document, so a typo mid-expression never loses your place.
Why does my JSON look slightly different after formatting?
Two normal things happen when JSON is parsed and re-serialized. Duplicate keys collapse to the last value, so {"a":1,"a":2} comes back as {"a":2}, and numbers get normalized, so 1.0 may return as 1. There's also a precision trap: integers past what JavaScript represents exactly (2^53) can lose their tail digits. Moving IDs or money values that big? Keep them as strings in your source so nothing rounds.
Does "Valid" mean my JSON matches a schema?
No. Valid here means the syntax parses, that quotes, commas, brackets, and braces all line up. It does not check that a price field is a number or that a required email exists. That's JSON Schema validation, a separate layer you'd handle with a library like Ajv. This tool answers the more basic question first: is the text even parseable JSON?
What if the file is really large?
Small and medium files format the instant you click. Something in the tens of megabytes has to sit in memory all at once and can crawl or choke a low-memory device. For files that big, jq on the command line (jq '.' big.json) handles any size without trouble. For everyday API responses, configs, and log lines you'll never come close.
Can I rename the downloaded file?
Not up front. Download writes the file as formatted.json and you rename it once it's saved, since the browser won't let the page pop a Save As box for a plain download. Worth knowing: it always saves the whole formatted document, even with a JSONPath filter showing in the output box. If you only want the filtered part, select it from the box and copy that instead.
Does it work without an internet connection?
Yes, once the page has loaded. The parsing and formatting are local, so after the tab is open you can pull the network cable and it keeps going. Bookmark it and it runs on a plane, on a locked-down work laptop, or on an air-gapped box where pasting into some random website isn't an option anyway.