JSON Formatter and Validator
Format, minify and validate JSON in your browser. Choose 2 or 4 space indent, sort keys, and get size and structure stats. Copy or download the result.
Format, minify, repair, explore and query JSON. Exact numbers, clear errors, everything stays in your browser.
My snippets (0)
No snippets yet.
Saved data on this device
Checking storage...
Found a Bug or Missing a Feature?
Report any problems or suggest new features you want. You can write in English, Urdu, Hindi, or any language! Our AI will analyze your feedback and upgrade the tool.
About This Tool
Format, minify and validate JSON in your browser. Choose 2 or 4 space indent, sort keys, and get size and structure stats. Copy or download the result.
Broken JSON rarely announces itself kindly. An API returns a wall of text, a config file refuses to load, or a build fails with "Unexpected token" and a character position that means nothing to a human. This tool reads your JSON the way a strict parser would, tells you the line and column of the problem in words, and shows the offending line with a caret under the exact spot.
Reading the error message like a map
Most JSON errors come from a small family of habits. These are the ones the validator recognises and explains:
- A comma before a closing bracket: {"a":1,} is fine in many programming languages and invalid in JSON.
- A missing comma between two items: the error lands on the first character of the next key, which is where your eye should go.
- Single quotes: 'name' must be "name".
- Unquoted keys: {name: "Sara"} must be {"name": "Sara"}.
- Capitalised literals: True, False and None come from Python; JSON wants true, false and null.
- Leading zeros: 007 is not a valid number.
- Two documents glued together: a JSON file holds one value, so several records belong inside [ ].
Press Jump to error and the cursor lands on the character. If the tool can repair the text, a Try auto-repair button appears next to the message.
Auto-repair, and why it tells you what it did
Auto-repair removes comments, turns single quotes into double quotes, quotes bare keys, drops trailing commas, replaces Python and JavaScript literals, and adds obvious missing commas. After the run you get a plain list such as "unquoted keys quoted (4), comments removed (2)". Skim it before you trust the result. A repair that has to guess is a repair you should read.
The number problem most formatters hide
Take the ID 12345678901234567890. A JavaScript program reading it keeps only about 15 to 16 significant digits, so it comes out as 12345678901234567000, and the last digits are silently wrong. This formatter keeps numbers as the text you typed, so the ID survives formatting untouched, and it warns you when a number is too large for JavaScript to store exactly. If you see that warning, send such IDs as strings.
Five ways to look at the same data
- Format and Minify with a 2-space, 4-space or tab indent, and optional A-to-Z or Z-to-A key sorting that reaches into nested objects.
- Tree view to fold and unfold sections of a big response. Click a key to copy its path.
- Query path to pull out just the part you need, like every email in a list of users.
- TypeScript types to turn a sample response into interfaces, marking keys that are missing in some items as optional.
- Escape and Unescape to wrap JSON into a string for code, or to open a string that was escaped by another system.
When the data starts or ends somewhere else
JSON often travels between spreadsheets and programs. If your source is a table, the CSV to JSON Converter turns rows into objects. If you need to hand the data to someone who lives in Excel, the JSON to CSV Converter goes the other way.
What stays on your device
The last thing you pasted is remembered so a refresh does not lose your work, and you can save named snippets for configs you reuse. All of it sits in your browser storage. Use the Saved data panel to export a backup or wipe everything.
Common questions about this JSON tool
Why does my JSON fail when it works in JavaScript?
JavaScript object syntax is looser than JSON. Single quotes, unquoted keys, comments and trailing commas are fine in code but not in JSON. Auto-repair mode fixes these and lists every change it made.
Does formatting change my data?
No. Format and Minify only change spacing. Numbers and text escapes are copied exactly as written, so 1.0 stays 1.0 and a long ID is not rounded.
What does the query path accept?
Paths such as $.users[0].name, $.items[*].id, $.config.* and ..id (find every id at any depth). Quote keys that contain spaces, like $["first name"].
How large a file can it handle?
Files up to 25 MB can be opened. Live validation switches itself off for very large input so typing stays smooth, and you can still press Ctrl+Enter to run it.
Is my JSON sent anywhere?
No. Parsing and formatting happen in your browser. Only your settings, your last input and any snippets you choose to save are stored locally on this device.
