JSON Error Codes

Every diagnostic the JSONLint validator can report, with a plain-English explanation, an example, and how to fix it. Paste your JSON into the validator to see all of these at once, each linked to its reference page.

Errors

These make the document invalid — it will not parse until they are fixed.

E001Unexpected characterA character appeared that is not part of JSON syntax.E002Trailing content after the JSON valueExtra content appears after the top-level value ended.E003Unexpected identifierA bare word was found where a value was expected.E004Unexpected end of inputThe document ended while a value was still expected.E005Expected a valuePunctuation appeared where a value belongs.E006Unclosed object or arrayAn object or array was opened but never closed.E007Leading comma in objectAn object starts with a comma before its first member.E008Trailing commaA comma appears before a closing brace or bracket.E009Missing comma between itemsExpected ',' or a closing bracket between two values.E010Strings must use double quotesA string was written with single quotes (').E011Smart quote foundA curly “smart” quote appeared where a string was expected.E012Number cannot start with + or .A number began with a leading '+' or '.'.E013Unterminated stringA string was opened but never closed.E014Invalid \u escapeA \u escape was not followed by four hex digits.E015Invalid escape sequenceA backslash was followed by a character that is not a valid escape.E016Unescaped control character in stringA raw control character (tab, newline, etc.) appears inside a string.E018Number has a leading zeroA number has an extra zero in front of it.E019Malformed numberExpected a digit that is missing from a number.E020Unterminated block commentA /* comment was never closed with */.E021Comments are not allowed in strict JSONA // or /* comment appeared in strict JSON.E022Object keys must be quotedAn object key was written without double quotes.E023Expected an object keySomething other than a key appeared inside an object.E024Expected ':' after object keyA colon is missing between a key and its value.E025Leading byte-order mark (BOM)The input begins with a UTF-8 BOM.E026Input is UTF-16/UTF-32 encodedThe bytes look like UTF-16 or UTF-32, not UTF-8.E027Invalid UTF-8 byteA byte in the input is not valid UTF-8.E030Language literal is not valid JSONA Python/JavaScript literal such as True, None, or undefined was used.E031NaN or Infinity is not valid JSONA NaN or Infinity value was used.E040Maximum nesting depth exceededThe JSON is nested more deeply than the parser allows.

Warnings

The document is still valid JSON, but these are common sources of bugs.

These codes are produced by @jsonlint/core, the open-source engine behind JSONLint. Run the same checks in your own tooling with npm install @jsonlint/core.