JSON, XML & YAML Error Messages
Comprehensive guide to common parsing errors and how to fix them. Find your error message below for instant solutions.
๐ก Quick Fix Tips
{ } JSON Errors
SyntaxError: Unexpected token
The parser found a character that doesn't belong in valid JSON at the specified position.
Common Causes:
- Trailing comma after the last element
- Single quotes instead of double quotes
- Unquoted property names
- Comments in JSON (not allowed)
- Missing comma between elements
โ Wrong
{
"name": "John",
"age": 30, // trailing comma!
}โ Correct
{
"name": "John",
"age": 30
}SyntaxError: Unexpected end of JSON input
The JSON string ended before all structures were properly closed.
Common Causes:
- Missing closing brace }
- Missing closing bracket ]
- Incomplete string (missing closing quote)
- Empty input string
โ Wrong
{
"users": [
{"name": "John"}
// missing ] and }โ Correct
{
"users": [
{"name": "John"}
]
}SyntaxError: Expected property name or }
An object was expected to have a property name but found something else.
Common Causes:
- Extra comma creating empty slot
- Missing property name before colon
- Typo in property structure
โ Wrong
{
"name": "John",
, // extra comma
"age": 30
}โ Correct
{
"name": "John",
"age": 30
}SyntaxError: Unexpected string
A string appeared where it wasn't expected, usually due to missing comma.
Common Causes:
- Missing comma between properties
- Missing colon after key
โ Wrong
{
"name": "John"
"age": 30
}โ Correct
{
"name": "John",
"age": 30
}SyntaxError: Bad escaped character
An invalid escape sequence was found in a string.
Common Causes:
- Invalid escape like \x instead of \u
- Unescaped backslash
- Invalid unicode escape sequence
โ Wrong
{"path": "C:\Users\name"}โ Correct
{"path": "C:\\Users\\name"}</> XML Errors
XML Parsing Error: not well-formed
The XML document doesn't follow proper XML syntax rules.
- Missing closing tag
- Mismatched tag names
- Invalid characters in element names
- Missing root element
XML Parsing Error: mismatched tag
An opening tag doesn't match its closing tag.
- Typo in tag name
- Wrong closing tag order
- Case sensitivity (XML is case-sensitive)
XML Parsing Error: undefined entity
An entity reference (like &foo;) is not defined.
- Using HTML entities without declaration
- Unescaped & character
- Missing entity definition in DTD
--- YAML Errors
YAML Exception: bad indentation
Indentation levels are inconsistent or use tabs instead of spaces.
- Mixing tabs and spaces
- Inconsistent indentation levels
- Wrong number of spaces
YAML Exception: mapping values not allowed
A colon appeared in an unexpected location.
- Unquoted string containing colon
- Missing space after colon
- Invalid key format
YAML Exception: duplicate key
The same key appears more than once in a mapping.
- Copy-paste error
- Accidental duplicate key names
Validate Your Code
Use our free validators to find and fix errors instantly