Make messy JSON readable, or squeeze it back down. Paste it in and get it pretty printed with the indent you choose, minified to one line, or with its keys sorted. If it is broken, the error points at the exact line and column instead of a character position you have to count to.
Free Forever Nothing Uploaded Line and Column Errors Sort Keys
Share this tool
Advertisement Slot (Top Banner)Google AdSense Unit • Responsive Banner
JSON Formatter & Validator Everything happens in this tab. Nothing you paste is sent anywhere.
Your JSON
Formatted
Output
Valid JSON.
0 keys0 objects0 arrays0 levels deep
Buy Us A Coffee
Enjoying WizTools123? Help keep our server infrastructure
100% free and open for everyone.
Not "position 428", which you then have to count to.
The browser can tell you JSON is broken, but its message changed for the worse: older
versions said "position 428", and the current one often says only "Unexpected token" with
no location at all. Neither helps when the file is a thousand lines long and the missing
comma is somewhere in the middle.
This page walks the JSON itself to find the first thing that is wrong, and reports
the line and column. A missing comma, a trailing one, a single quote where a double
was needed, a key without quotes: each is caught at the exact spot, with a plain sentence
saying what was expected there. The formatting is still done by the browser's own parser,
which is fast and correct; the scanner only runs to locate a problem when there is one.
Strict JSON is stricter than it looks, and that is on purpose. Comments are not
allowed, trailing commas are not allowed, keys must be in double quotes, and a single
quote is never valid. A lot of things that look like JSON, including JavaScript object
literals and the JSON5 dialect, break these rules. This validates real JSON, so it will
reject those, which is the right answer if the file has to be read by something other
than JavaScript.
Where Your Input Goes
Nowhere. And you can check that yourself.
JSON from an API often has real data in it, and this page never receives it.
It is all done by your own browser. Press F12, open the Network tab, and use the tool:
the page fetches its own code and nothing else. Or load the page, turn off your wifi, and
carry on. It still runs, because there was never a server in the middle.
How to Format and Validate JSON
A few steps, and nothing is uploaded.
1
Paste your JSONMinified, messy, or copied from a log. It is formatted as you type, and nothing is uploaded.
2
Choose how it comes outTwo spaces, four, or a tab, or minify it back to a single line. Keys can be sorted alphabetically.
3
Read the checkValid JSON gets a green tick and a count of its keys, objects, arrays and depth. A mistake is pointed at by line and column.
4
Copy or downloadOr press Use as input to run another pass, such as minifying what you just sorted.
What to Know About JSON
Including the things this tool cannot do.
The error message gives you a line and a column, which the browser no longer does. A hand-written scanner walks the JSON to the first thing that is wrong and names it: a missing comma, a trailing one, an unquoted key, a string left open. The formatting itself is done by the browser's parser, which is fast and exactly correct; the scanner only runs to locate a fault.
This is strict JSON, not JavaScript and not JSON5. Comments, trailing commas, single quotes and unquoted keys are all rejected, because real JSON forbids them. A file that uses any of those is fine as a JavaScript object but is not valid JSON, and a parser on another platform will refuse it. Rejecting it here is the tool doing its job.
Sorting the keys changes the order but never the meaning. JSON objects are unordered by definition, so a consumer that depends on key order is already relying on something the format does not promise. Sorting is useful for comparing two files or making a diff readable, and it goes all the way down, not just the top level.
Very large files are held in memory, all of them. This formats the whole document at once rather than streaming it, so a file of tens of megabytes will make the tab work hard. For everyday API responses and config files it is instant; for a giant export, a command line tool that streams is the better fit.
Key Features & Capabilities
What this tool does, and what it deliberately does not.
Line and column errorsA hand scanner finds the first fault and names it, where the browser now gives no position.
Pretty print or minifyTwo spaces, four, or a tab, or squeezed to a single line.
Sort keysAlphabetically, all the way down, for cleaner diffs and comparisons.
Shows the shapeCounts the keys, objects, arrays and how many levels deep it goes.
As you typeNo button. The result and the validity update while you edit.
Nothing uploadedAn API response often has real data in it; here it stays in your tab.
About the JSON Formatter
JSON is easy to read until it is not. A response comes back on one line, a config file has an error somewhere in five hundred lines, a payload needs to be compared against another. Formatting it by hand is impossible and pasting it into a site that uploads it is a bad idea when the data is real, which for an API response it usually is.
This formats and validates it in your browser. Pick the indent or minify it, sort the keys for a clean comparison, and see a count of what is inside. The part that took the most care is the error message: browsers used to tell you the position of a mistake and now often do not, so this walks the JSON itself and reports the exact line and column, with a sentence saying what it expected there.
It validates strict JSON, which means it rejects the comments, trailing commas and single quotes that a JavaScript object allows. That is deliberate. If a file has to be read by a program written in another language, it has to be real JSON, and a validator that quietly accepted the loose version would be hiding the problem rather than showing it.
Frequently Asked Questions
Strict JSON, where your error is, and what sorting keys does.
Almost certainly because your code uses a JavaScript object literal or JSON5, not strict JSON. Comments, trailing commas, single quotes and unquoted keys all work in JavaScript and none of them are valid JSON. If the data has to be read by a program in another language, it must be strict JSON, which is what this checks.
The message gives a line and a column and a sentence saying what was expected there. Unlike the browser, which now often reports no position at all, this scans the document to the first fault and points at it, so you are not counting characters to find a missing comma.
No. JSON objects have no defined order, so any program reading them correctly does not care about the order of keys. Sorting is there to make two files easy to compare and to produce a clean diff. It sorts every level, not just the outermost.
The whole document is held in memory and formatted at once, so very large files, in the tens of megabytes, will make the browser work hard. Ordinary API responses and config files are instant. A file opened from disk is capped at 5 MB.
No. It is parsed and formatted by your browser. API responses often contain real data, tokens or personal information, and none of it leaves your tab. You can confirm this in the Network tab or by working offline.