JSON Validator — Validate & Lint JSON Online

JSON Validator

Paste JSON into the editor. The status bar shows whether it parses, and the Validate command reports the first syntax error with its line and column. A document that parses but repeats a key gets a warning. Validation runs in your browser, and the validation code makes no network request.

How this tool checks JSON

Validation calls JSON.parse on the editor text (validate in BaseJsonService, src/lib/Lang/v2/json/BaseJsonService.ts, which ValidateJsonService extends). The tool has no grammar of its own, so it accepts and rejects what the browser's JSON parser accepts and rejects. On top of that result:

  • Error location. The message is the engine's own text. The tool reads the line N column M or position N part and moves the cursor there (parseJsonError, src/lib/Lang/v2/json/parseJsonError.ts). The error bar also shows a short explanation, such as "Missing comma between properties or extra trailing comma".
  • Duplicate keys. For valid JSON the tool scans the text for repeated keys in the same object and lists each one with its line and column. JSON.parse keeps only the last value, so the earlier value is lost without an error.
  • Live status. While you type, the status bar shows valid or invalid, the node count, and a warning for integers beyond 2^53, which lose precision when formatted. Live status is paused for documents over 1,000,000 characters. The toolbar commands still run on the full text.

Validation checks syntax only. It does not check the document against a JSON Schema.

The Fix action in the error bar repairs the input with jsonrepair. It shows the list of changes, and Undo restores the original text. Format, Minify, Tree View and the conversion commands sit on the same toolbar.

Worked example

Input, a tsconfig-style file with a trailing comma after "strict": true:

{
  "compilerOptions": {
    "target": "es2020",
    "strict": true,
  },
  "include": ["src"]
}

Validate returns this text. The output pane shows it after a cross mark:

Invalid Json:
Error: Expected double-quoted property name in JSON at position 71 (line 5 column 3)

The comma is on line 4, but the parser reports the problem at line 5, column 3, where it found the next key. Fix returns this text, which is the same repair that the Auto Correct command writes to the output pane:

{
  "compilerOptions": {
    "target": "es2020",
    "strict": true
  },
  "include": [
    "src"
  ]
}

Gotchas

  1. The error can sit after the mistake. A trailing comma is reported on the line after it, because the parser only notices the problem when it reaches the next token. Look one line up from the reported position.

  2. Duplicate keys are valid JSON. {"port": 8080, "port": 9090} validates, with a warning that the first value is lost. Some tools keep the first value instead, so the file can mean different things in different places.

  3. Fix can hide missing data. Input {"a": [1, 2 is cut off in the middle. Fix closes the open brackets and produces {"a": [1, 2]}. The result is valid, but the rest of the data was never there. Fix shows a notice when the input looks truncated. Auto Correct shows the same warning as a toast, except in live mode.

  4. Large integers change on format. {"id": 12345678901234567890} validates, because the text is a valid number. Formatting it gives 12345678901234567000. The status bar counts integers above 2^53 and warns about this.

  5. A byte-order mark breaks validation. A document that starts with the invisible character U+FEFF fails with Unexpected token, and the token shown looks like nothing. Remove the first character of the text and validate again.

  6. Single quotes are not JSON. {'a': 1} fails with Expected property name. Fix converts the quotes, but a hand edit has to change every quote.

FAQ

Does it validate against a JSON Schema? No. It checks syntax, and it reports duplicate keys in otherwise valid JSON. A schema check needs a separate validator that takes the schema as input.

Can it fix my JSON automatically? Fix repairs common problems such as trailing commas, missing commas, unquoted keys, single quotes and unclosed brackets. It lists each change, and Undo returns the original text. Review the output, because a repair can keep the syntax valid while data is missing.

Does it handle big files? Validate and Fix run on the full text. Live status stops updating above 1,000,000 characters, so the status bar shows no node count there. The Validate command still works on the document.

Why does the error line not match where I made the mistake? The parser reports the first position where the text stops being valid. For a missing or extra comma that is often the next token. See gotcha 1.

Is my JSON uploaded? No. The validation code makes no network request, and the document stays in your browser tab.