Valid JSON has a small, strict grammar, and almost every real world validation failure comes down to one of a handful of causes: a trailing comma after the last item in an object or array, a property name that is not wrapped in double quotes, a single quote used instead of a double quote, or an unescaped control character inside a string. Knowing which of those it is, and exactly where in the file it happened, is the difference between fixing a document in five seconds and scanning the whole thing by eye.
Validation happens entirely in your browser using the native JSON parser, so a payload containing an API key, a customer record or an internal configuration file never has to leave your machine to be checked. That makes it possible to validate json online for genuinely private data with no compromise.
What a json validator actually checks
Syntax validation confirms the document follows JSON's grammar: every string is double quoted, every object key is a string, commas separate items correctly with none trailing after the last one, and brackets and braces are balanced and properly nested. That is what a json validator does. It is a narrower guarantee than checking that the data means what you expect, since a syntactically valid JSON document can still have the wrong shape for your application, missing a field your code expects or using a string where a number was intended.
This tool focuses specifically on syntax, since that is the layer where a single misplaced character causes a total parse failure and where a precise error location is the most useful thing a validator can offer. Checking that specific fields exist and have the right type is a separate concern usually called schema validation, and it requires knowing what shape the data is supposed to have in the first place.
- Confirms brackets and braces are balanced and correctly nested.
- Confirms every string is wrapped in double quotes, never single quotes.
- Confirms there is no trailing comma after the last item in an object or array.
- Confirms every object key is itself a valid JSON string.
- Reports the exact line and column where the first syntax error occurs.
Reading the json error line number this tool reports
When validation fails, the message names the line and column of the character where the parser gave up, along with a short excerpt of the surrounding text so you do not have to scroll to find it. In practice the actual mistake is often one character before the reported position, since a parser generally only realises something is wrong once it reaches the next token and finds it does not fit, for example discovering a closing brace where it expected another property.
A trailing comma is the single most common real world failure, because it is completely legal in a JavaScript object literal and only invalid in strict JSON, so code copied from a JavaScript file frequently fails validation for exactly this reason. The error position for a trailing comma issue almost always points at the closing bracket or brace immediately after it.
The structural stats this tool reports for valid JSON
Once a document parses successfully, the validator reports its maximum nesting depth, the total number of keys across every object in the document, and its size in bytes. Depth is a useful early warning sign: a document nested more than six or seven levels deep is often a sign that data which should be a flat list has been wrapped in unnecessary layers of objects.
Key count and size together give you a quick sense of how much data you are looking at before deciding how to process it, whether that means loading it directly, streaming it, or converting it into a different format such as CSV for a smaller, tabular view of the same information. Running these stats is the last step of using this json validator, after the document has already been confirmed to parse cleanly.
How this json validator works under the hood
The tool uses the browser's native JSON.parse to check structure. That single function call, implemented in the browser engine rather than in JavaScript, does the full check json structure work of confirming every bracket, brace, quote and comma follows the grammar, and it throws a JavaScript error with a position embedded in its message the moment it hits something invalid. This tool's job is to translate that raw position into a line, a column and a readable excerpt.
Because the check runs natively in the browser, even a multi megabyte JSON document validates in a fraction of a second with no server round trip, no upload and no size limit beyond your device's available memory.
How to validate JSON
- 1
Add your JSON
Paste JSON into the input box, or drop a .json file onto the page. Nothing is uploaded.
- 2
Run validation
Press validate to check the document's syntax against the strict JSON grammar.
- 3
Read the result
A valid document shows depth, key count and size. An invalid one shows the exact line and column of the error.
- 4
Fix and re-check
Correct the reported character, then validate again until the document parses cleanly.
Related tools worth bookmarking
Sources and further reading
- JSON.org: Introducing JSONThe official reference describing the exact grammar this validator checks input against.json.org
- MDN: JSON.parseThe browser API this validator uses, including how it reports the position of a syntax error.developer.mozilla.org
- RFC 8259: The JSON Data Interchange FormatThe IETF standard defining valid JSON syntax, including the comma and quoting rules most validation failures violate.rfc-editor.org
Frequently asked questions
Common questions about the json validator.
Strict JSON grammar does not allow a comma after the last item in an object or array, even though many JavaScript engines tolerate it in an object literal. This is one of the most common causes of a failed validation for JSON that started life as JavaScript code, and the error position points at the comma or the closing bracket right after it.
Syntax validation, which this tool performs, confirms the document follows JSON's grammar correctly, meaning it can be parsed at all. Schema validation is a separate, stricter check that confirms specific fields exist and hold the expected type, which requires a schema definition describing the shape the data is supposed to have.
No. Validation runs entirely in your browser using the native JSON.parse function. Your document, including any private API response or configuration file, is never transmitted, stored or seen by anyone but you.
A JSON parser reports the position where it first noticed a problem, which is often the character right after the actual mistake, since the parser has to read one token past the error before it can tell something is wrong. If the reported position looks correct but nothing seems wrong there, check the character immediately before it.
Depth counts how many levels of nested objects and arrays the document contains. A very deep document, more than six or seven levels, is often worth a second look, since data that conceptually should be a flat list is sometimes accidentally wrapped in extra layers of single key objects during generation.
Yes, up to the limit of your browser tab's available memory, typically several hundred megabytes on a modern laptop. There is no server side size cap, since validation happens entirely on your own device using the browser's built in JSON parser.