What the validator checks
It parses your input with the browser's own JSON.parse — the same implementation that will run in your application. If it passes here, it will parse there. The result panel shows the normalized document plus a quick structural summary: the top-level type, total key count, and maximum nesting depth.
Reading the error
A failure reports a message, a line and a column. The column points at where the parser gave up, which is usually one character past the real mistake — a missing comma is discovered when the next key arrives, not where the comma should have been. Look at the end of the previous line first.
The errors you will actually hit
- Trailing comma —
[1, 2, 3,]. Valid JavaScript, invalid JSON. This is the single most common failure. - Single quotes —
{'id': 1}. JSON strings are double-quoted, always. - Unquoted keys —
{id: 1}is an object literal from JavaScript source, not JSON. - Unescaped control characters — a raw newline or tab inside a string must be written as
\nor\t. See the escape tool. - Non-finite numbers —
NaN,Infinityandundefinedare not part of the grammar. Serialize them asnullor a string. - A byte-order mark — an invisible
U+FEFFat the start of a file trips many parsers. If the error points at column 1 of line 1 and the line looks fine, this is usually why. - Truncated output — a payload cut off by a log limit ends mid-token. The error lands on the last line of the document.
Valid JSON in one paragraph
A JSON document is a single value: an object, an array, a string, a number,true, false, or null. Objects hold comma-separated"key": value pairs with double-quoted keys. Arrays hold comma-separated values. Numbers use decimal notation with an optional exponent and no leading +, no leading zeros, and no hex. Strings are double-quoted, with backslash escapes for ",\, /, b, f, n, r,t, and uXXXX. There are no comments and no trailing commas.
Validating in code
# shell
jq empty data.json && echo valid
# Python
try:
json.loads(text)
except json.JSONDecodeError as e:
print(e.msg, e.lineno, e.colno)
// JavaScript
try { JSON.parse(text) } catch (e) { console.error(e.message) }
-- SQL Server / MySQL
SELECT ISJSON(payload); SELECT JSON_VALID(payload);Each of these gives a yes-or-no answer plus, in most cases, a position. Python'sJSONDecodeError is the most informative of the group, carrying msg,pos, lineno and colno as separate attributes — log those rather than the payload itself when the input might contain anything sensitive.
After it validates
A document that parses is not necessarily the document you wanted. Once the syntax is clean,format it to read the structure, sort the keys if you are about to diff two responses, or convert it to CSV if it is an array of records headed for a spreadsheet. If it fails here because the payload is escaped rather than malformed, the string to JSON converter will unwrap it first.