Skip to content
cosmodev ~/tools/json-validator

Валидатор JSON

Validators & Testers

Валидируйте JSON и точно определяйте ошибки с номерами строк и столбцов. Понятный вердикт валиден/невалиден плюс точное место ошибки — все выполняется в вашем браузере.

Результат
Введите или вставьте JSON для валидации.

(Документация на английском)

What it does

Checks a JSON document on every keystroke and pins down exactly where it breaks. A badge switches between Valid JSON and Invalid JSON as you type. When the document is valid, a four-cell panel reports its size in bytes (UTF-8), its top-level type, its key or item count, and its maximum nesting depth. When it is invalid, the error names the line and column, and a second panel quotes the offending line from your input. Everything runs locally in your browser; nothing you paste is sent anywhere.

How to use it

  1. Paste or type JSON into JSON input. Tap Sample for a demo document, Clear to empty the box.
  2. Read the badge: Valid JSON (green) or Invalid JSON (red).
  3. If valid, read the stats panel:
    • bytes - the document’s UTF-8 size, not its character count.
    • type - one of array, object, string, number, boolean, null.
    • keys (objects) or items (arrays) - the top-level count only.
    • depth - maximum nesting; the top level counts as 1.
  4. If invalid, read Line X, Column Y: <reason>, then the quoted line below it.
  5. Copy input duplicates your text; Copy share link encodes it in the URL (?j=...).

Examples

{"name":"CosmoDev","free":true,"tools":["json","base64"]}

Result: Valid JSON, 57 bytes, type object, 3 keys, depth 3. The strings inside tools sit two levels under the root, so the depth is 3.

A scalar is a complete JSON document:

Input Verdict Stats
123 Valid JSON 3 bytes, type number, depth 1
true Valid JSON 4 bytes, type boolean, depth 1
null Valid JSON 4 bytes, type null, depth 1

An error pinned to its place:

{"a": 1}
extra

Result: Line 2, Column 1 with the reason, and the panel below quotes extra.

How JSON validation works

A JSON parser reads the document once, left to right, and stops at the first character that cannot legally appear where it appears. The tool then maps that character’s offset to a position: it counts newlines before the offset for the line, and characters since the last newline for the column. Both are 1-based, so Line 2, Column 1 means the very start of the second line. The quoted panel prints that line from your input, so the excerpt always comes from your document, never from a generic template.

Four mistakes cause most invalid JSON in practice:

Mistake Example Why it fails
Trailing comma {"a":1,} after a comma the parser expects a key, and } is not one
Single quotes {'a':1} strings and keys must use double quotes
Unquoted key {a:1} keys are strings, and strings are quoted
Comment {"a":1} //x JSON defines no comments at all

None of these is a matter of style. The JSON grammar (RFC 8259) allows exactly one spelling for each, and the parser enforces it. That strictness is the point: a document that validates here parses identically in every conforming parser, in every language.

Good to know

  • First error only: the parser stops at the first problem. Fix it, re-validate, and the next one surfaces.
  • Engine differences: when the underlying engine reports no position, the verdict still shows the raw message.
  • Shareable: your input is encoded in the URL (?j=...), so a link reproduces the exact view.
  • Private: safe for configs, credentials, and API payloads.
  • Related tools: JSON Formatter, JSON Minify, JSON ↔ CSV Converter.
Исходный код14 языков

100% на стороне клиента · ваши данные никогда не покидают ваш браузер. Нашли это полезным? Поделитесь с коллегой.