✅

JSON Validator

✓ Free & no signup 🔒 Runs 100% in your browser Updated 2026-11-25 Development Tools

When an API returns 400 Bad Request or a deploy pipeline dies on a config file, the actual cause is usually one character in one line of JSON, and finding it by eye in a 900-line document is a miserable way to spend an afternoon. This validator does one job: it parses your JSON strictly and, if the syntax is broken, tells you the exact line and column where parsing stopped. It does not reformat, repair, or guess. You paste, you get a verdict, you fix the real problem.

The single-error design is a feature, not a limitation. JSON parsers stop at the first syntax violation they meet, and every error after the first is unreliable anyway — a missing closing brace early in a document makes the parser misinterpret everything downstream, producing a cascade of phantom complaints about lines that are perfectly fine. Report the first error, fix it, re-validate, and repeat. Three quick passes usually finish what an hour of staring cannot.

Validation runs entirely in your browser, so it is safe for payloads with credentials, personal data, or anything else you would not paste into an unknown web service. No upload, no account, works on mobile.

What Counts as Invalid JSON

JSON's grammar is tiny and strict, which is why the same handful of mistakes account for nearly every failed validation. The table below lists the offenders, an example of each, and where they typically sneak in:

ErrorInvalid exampleCommon source
Trailing comma{"a": 1, "b": 2,}Editing by hand, deleting the last item
Single quotes{'name': 'Ada'}Copying from Python or JavaScript code
Unquoted keys{name: "Ada"}Pasting from a JS object literal
NaN / Infinity{"score": NaN}Serializing JavaScript numbers carelessly
Comments{ // config }Confusing JSON with JSON5 or config formats
Smart quotes{"name": "Ada"} with curly quotesPasting from chat apps or word processors

Trailing commas deserve special mention because they are the number one offender in practice. JSON forbids a comma after the final member of an object or array, even though JavaScript itself has allowed them since 2017. If you maintain a config file by hand, every edit that removes the last item of a list leaves one behind, and the validator will point at the closing bracket rather than the comma — remember that the reported column marks where parsing gave up, and the stray comma is usually one or two characters earlier.

NaN is its own trap. NaN and Infinity are legal JavaScript values but not legal JSON numbers, and some home-grown serializers emit them anyway. If your validator flags NaN, the producing code needs a fix, not the data: decide whether the value should be null or omitted entirely, because there is no JSON representation for an undefined number.

How to Use It (Step by Step)

  1. Paste the JSON you suspect is broken. If it parses cleanly, the tool tells you so immediately and you can stop looking here.
  2. On failure, read the reported line and column. Line 1, column 1 is the very first character; editors and this tool count the same way.
  3. Go to that position in your text and look slightly before it: the culprit is usually the token just prior, such as the comma or quote before the character the parser choked on.
  4. Fix exactly that one error. Resist fixing several things at once, because a cascade of phantom errors will reshuffle after each fix anyway.
  5. Re-validate. Repeat until you get a clean pass. For a badly corrupted document, expect two to four rounds.
  6. Once valid, the document is guaranteed parseable by any standards-compliant consumer — API gateway, CI step, or application code.

How Line and Column Are Calculated

Under the hood, the browser's JSON parser stops at the first violation and reports a character offset into your text. The validator converts that offset into a line and column: newlines encountered before the offset increment the line counter, and the column is the distance from the last newline, counting from column 1. A multi-line paste behaves exactly like a file in your editor — if you saved the same text to disk and ran a strict parser on it, you would get the same position.

Two honest caveats about what the position means. First, it marks where the parser gave up, not necessarily where your mistake lives. A missing closing brace on line 40 can surface as an error on line 87, where the document actually ends; a stray character inside a string can shift everything after it. Second, the position refers to the text exactly as pasted, including any blank lines you may have added around it. If you paste with a leading newline, every reported line will be one higher than in the original file, which occasionally confuses people cross-referencing an editor.

A worked example. Paste this four-line document:

  • Line 1: {
  • Line 2: "service": "billing",
  • Line 3: "retries": 3,
  • Line 4: "timeout": 5000,

The error is reported at or near the end of line 4: the parser consumed the comma after 5000, expected another key or the closing brace, and hit end of input. The fix is deleting the final comma, and the reported column lands right around that comma's neighborhood. After removing it, the next validation passes instantly.

The API Debugging Workflow

Validation earns its keep in three recurring API situations. Before blaming your code, validate the raw response body: a surprising share of "my client library is broken" reports are actually a proxy error page, an HTML login redirect, or a server stack trace that merely looks like JSON because it starts with a brace. Validate before you parse, and you will never chase a phantom bug again. Before sending a request, validate the payload you built programmatically — a serializer bug, a template typo, or an accidentally stringified object shows up in seconds. And when a third party hands you a webhook definition or an import file, validate it before wiring it into anything, because vendors ship invalid JSON more often than anyone admits.

One more production habit: treat validation as a gate in local tooling rather than eyeballing output in a terminal. Paste, verify, ship — the two seconds it takes beats a failed deploy, and because nothing leaves your machine, there is no reason to hesitate even with sensitive payloads.

Validator vs Formatter vs Linter

These three roles get blurred, so here is the honest boundary. A validator answers one question: does this text parse as JSON, and if not, where did parsing stop? A formatter assumes valid input and changes its presentation. A linter goes further, flagging stylistic issues such as inconsistent indentation or keys that are technically fine but suspicious. This tool is deliberately the first kind only. That focus keeps the error reporting sharp and avoids the trap of "fixing" documents silently — a tool that repairs JSON for you will occasionally repair it into something you did not mean, and you will ship the result. Strict pass or strict failure, nothing in between, is the behavior you want when a document is about to be consumed by a machine that will be just as strict.

Tips and Best Practices

  • Validate after every hand edit to a config file. The trailing-comma mistake reappears the moment you get interrupted mid-edit.
  • When the error position seems wrong, look for an unclosed bracket much earlier in the file; the report marks where the parser collapsed, not the root cause.
  • If your JSON contains numbers you copy from spreadsheets, check for thousands separators like 1,234 inside values — the comma can masquerade as a syntax error one level up.
  • Paste the exact bytes, not a retyped version. Fixing "obvious" typos before validating hides the real error and can introduce a second one.
  • For files with secrets, validation here is safe since parsing is local; still, prefer keeping secrets in environment variables rather than in the JSON itself.

Frequently Asked Questions

How do I find the exact line and column of a JSON error?
Paste the JSON into the validator and it reports the position where parsing stopped, counted from line 1, column 1 the same way text editors count. Go to that spot and inspect the one or two characters just before it, since the reported column marks where the parser gave up while the actual typo is often the preceding comma, quote, or brace. Fix only that error, re-validate, and repeat — a corrupted file typically needs two or three quick passes rather than one giant edit.
Why is a trailing comma invalid in JSON?
The JSON grammar defines a comma strictly as a separator between members, so a comma after the last item has nothing to separate and fails parsing. JavaScript object literals tolerate trailing commas, and Python dicts allow them too, which is why code copied from those languages breaks as JSON so often. The fix is simply deleting the comma after the final key-value pair or array element. Notably, the error position usually points at the closing bracket or end of input rather than the comma itself, so check the characters just before the reported spot.
Does JSON allow single quotes instead of double quotes?
No. The JSON specification requires double quotes around both keys and string values, and single quotes always fail validation. This trips up developers moving between languages: Python, JavaScript, and many config formats accept single quotes, but JSON parsers do not. Curly smart quotes from word processors or chat apps are invalid too, even though they look similar. Replace every single quote used as a string delimiter with a straight double quote, and watch for apostrophes inside values, which are fine and need no escaping.
Is NaN valid JSON?
It is not. NaN, Infinity, and -Infinity are JavaScript number values but the JSON specification only allows decimal number literals, so serializing them produces text every strict parser rejects. The real fix belongs in the producing code: decide whether the value should be null, zero, or omitted from the object entirely, then serialize accordingly. If a validator flags NaN in your payload, the serializer that generated it is non-compliant, and any standards-based consumer downstream — an API gateway, a database import, another language's parser — will fail on the same input.
Can the validator fix my broken JSON automatically?
No, and that is deliberate. Auto-repair tools make assumptions — stripping trailing commas is safe, but guessing whether a single-quoted string should keep its quotes or interpreting NaN as null can silently change your data's meaning. This tool reports precisely where parsing failed so you make the judgment call yourself. The workflow is fast in practice: read the line and column, fix the one character, re-validate. Two or three iterations resolve most broken documents, and you finish with confidence that the fix matches your intent rather than a tool's guess.
Why do I get errors on lines that look perfectly fine?
JSON parsers stop at the first violation and reinterpret everything after it, so an early mistake produces misleading downstream errors. A missing closing brace around line 30 can make line 80's perfectly valid content appear broken, and one wrong quote inside a string can swallow the rest of the document. The rule of thumb: always fix the first reported error and ignore the rest, then re-validate. The cascade collapses once the root cause is gone, and what looked like five errors usually turns out to be exactly one.

Related Tools