6 min read
Common JSON Syntax Errors
Recognize trailing commas, invalid quotes, unescaped characters, and other JSON parsing failures.
Quotes and property names
JSON strings and object property names require double quotes. Smart quotes copied from a document editor and JavaScript-style single quotes both fail strict parsing.
Commas and brackets
A comma must separate values, but JSON does not allow a trailing comma after the last item. Mismatched braces and brackets can make the parser report an error later than the actual mistake.
Values JSON cannot represent
undefined, NaN, Infinity, functions, and comments are JavaScript concepts, not JSON values. Convert them to an agreed data representation before serialization.
