Free JSON Formatter & Validator — Beautify JSON Online
Beautify, validate, and debug messy or minified JSON instantly with a formatter built for real debugging work. Paste an API response or config file and get clean indentation, a collapsible tree view, and — when something is wrong — the exact line and column of the first error instead of a cryptic parser message. Duplicate keys, the silent bug every standard parser hides, are flagged with their line and path. Everything runs 100% locally in your browser, so private API payloads and tokens never leave your device.
Click Format, Minify, or Sort Keys.
🔍 JSONPath query
Extract values from your document — e.g. $.contact.website, $.courses[0], $.courses[*]. Format a valid document first.
7
Keys
2
Objects
1
Arrays
8
Primitives
2
Max Depth
235 chars
Output Size
How to Use
- 1Paste your raw or minified JSON into the editor, or drop a .json file onto it.
- 2Click Format to beautify with your chosen indentation (2, 4, 8 spaces, or tab).
- 3If the JSON is invalid, read the exact line and column shown — or click Auto-Fix for trailing commas, single quotes, and unquoted keys.
- 4Switch to Tree view to explore nested data, click any node to copy its JSON path, or run a JSONPath query to extract values.
- 5Copy the result or download it as formatted.json; use Minify or Sort Keys when you need a production payload or a deterministic diff.
Key Features
- ✓
Errors pinpointed to the exact line and column
Most formatters hand you a cryptic parser message. This one tells you the line and column of the first problem and shows the offending line with a caret underneath it — so you fix the comma, not hunt for it.
- ✓
Collapsible tree view with JSON paths
Switch to Tree view to explore nested data without counting brackets. Collapse what you don't need, expand what you do, click any node to get its exact JSON path, and copy it straight into your code.
- ✓
Duplicate-key detection
Standard parsers silently drop earlier duplicate keys — your config looks fine while a value quietly vanishes. This tool flags every duplicate with its line and path, a check almost no free formatter offers.
- ✓
JSONPath queries built in
Extract exactly what you need from a large payload: $.user.address.city, $.items[0], $.items[*]. Results show their full paths with one-click value copying — no more scrolling through a 10,000-line response.
- ✓
Auto-fix for the usual mistakes
Trailing commas, single-quoted strings, and unquoted keys are the three errors that break pasted JSON most often. Auto-Fix repairs them and shows you the result for review — it never silently rewrites your input.
- ✓
Sort keys, minify, and full stats
Sort object keys recursively for deterministic diffs, minify to a single line for production payloads, and read keys, objects, arrays, depth, and output size at a glance.
- ✓
Files in, files out
Drop a .json file onto the editor or upload it, then download the formatted result as formatted.json. Copy works on the output, on any tree path, and on any JSONPath result.
- ✓
100% client-side, honestly private
Formatting, validation, tree building, and queries all run in your browser's JavaScript engine. There is no server call, no logging, and no upload step — safe even for API keys and customer records.
Frequently Asked Questions
Is my JSON payload sent to any server?
What is the difference between Format and Minify?
Does it pinpoint syntax errors exactly?
What are duplicate keys, and why should I care?
What is a JSONPath query?
Can it fix broken JSON automatically?
Can I sort keys or download the result?
What is JSON — and why does it always arrive unreadable?
JSON (JavaScript Object Notation) is the lightweight text format that carries almost all data between systems today: REST and GraphQL API responses, configuration files, webhook payloads, database exports, and app settings. It has just six kinds of value — objects, arrays, strings, numbers, booleans, and null — which is why every language can read it. The problem is that machines write JSON for machines: minified onto a single line, with no indentation and no line breaks. A 200 KB API response pasted into an editor is one endless line, and finding a missing comma in it by eye is hopeless. A formatter re-indents that data with consistent spacing so its structure is obvious, and a validator confirms the syntax is actually correct. This tool does both, plus the inspection work — tree view, path queries, duplicate detection — that turns reading into debugging.
Format vs. minify vs. validate — when to use each
| Operation | What it does | Use it when |
|---|---|---|
| Format (beautify) | Adds indentation and line breaks | Reading, reviewing, or debugging a payload |
| Minify | Strips all unnecessary whitespace | Shipping a payload or storing it compactly |
| Validate | Checks syntax, reports the first error's position | Before pasting JSON into code, a request, or a config |
| Sort keys | Orders object keys alphabetically, recursively | Diffing two payloads or making output deterministic |
Note the honest limit of all four: they check syntax, not meaning. A formatter will happily beautify JSON with the wrong field names or the wrong types — that is what schema validation is for, and it is a separate step from formatting.
The syntax errors that break JSON most often
| Error | Typical cause | Fix |
|---|---|---|
| Trailing comma | { "a": 1, } | Delete the comma before the closing brace or bracket — or use Auto-Fix |
| Single quotes | {'a': 1} | JSON strings require double quotes — or use Auto-Fix |
| Unquoted keys | {a: 1} | Quote every key — or use Auto-Fix |
| Missing comma / bracket | Two values with nothing between them | Read the reported line — the error is usually just before it |
| Unterminated string | A closing quote was cut off in a copy-paste | Re-copy the full value; check the end of long strings |
One subtlety worth knowing: when a parser reports an error at some line, the actual mistake is often on the line above — a missing comma after a value, for instance, is only noticed when the parser meets the next key. The caret this tool shows marks where parsing failed; glance one line up if the marked line itself looks fine.
Duplicate keys: the bug no error message warns you about
JSON objects are not supposed to contain the same key twice, but nothing stops you from writing one — and every standard parser resolves it by silently keeping the last value and dropping the earlier ones. A config file with two “timeout” entries, or an API payload built by merging two objects, will parse as “valid” while behaving differently from what you expect. This tool's parser records every duplicate with its line and path, because a warning here saves an hour of debugging later. If you see one, decide which value is correct and delete the other — don't just reformat and move on.
JSONPath in 60 seconds
JSONPath is a small query language for reaching into a document without writing code. Start at the root with $, then walk down: $.user.address.city reads a nested field, $.items[0] takes the first array element, and $.items[*] returns every element. It is the fastest way to answer “what is the value at this spot?” in a response too large to scroll through, and the paths the tree view shows you are already in exactly this syntax — click a node, copy its path, paste it into the query bar. For adjacent jobs, the JSON to TypeScript converter turns a sample payload into typed interfaces, the JWT decoder breaks down tokens (whose payloads are JSON), the Base64 encoder & decoder handles encoded payloads, and the developer tools collection covers the rest of the workflow.
Related Tools You Might Like
Handy utilities in Developer Tools
JSON to TypeScript Converter
Convert JSON objects into clean TypeScript interfaces and types online for free. Auto-detects nested objects, arrays, and optional fields. 100% private.
CSV to JSON Converter
Convert CSV spreadsheets into JSON arrays and objects online for free. Automatic header detection, number parsing, and custom delimiters. 100% private.
JWT Decoder & Verifier
Free JWT decoder and verifier: decode header, payload and claims, check expiry with a live countdown, and verify HS256/RS256/ES256 signatures in your browser. Tokens never leave your device.