Trailing commas and quotes

JSON does not permit a comma after the final object property or array item. It also requires double quotes for property names and strings. JavaScript object syntax that accepts single quotes is not automatically valid JSON.

Format only after parsing succeeds; otherwise indentation can hide rather than solve the problem.

Escaping inside strings

Quotation marks, backslashes, control characters, and line breaks inside a string need valid escapes. A parser error may point after the true mistake because an earlier quote changed how the remainder was interpreted.

Unexpected values

undefined, NaN, Infinity, comments, functions, and dates are not native JSON value types. Convert them into deliberate strings, numbers, null, or structured representations before serialization.

Validation beyond syntax

Syntactically valid JSON can still violate an application contract. Use JSON Schema or application validation to check required fields, types, formats, ranges, and allowed values after basic parsing.

Use the related calculator

Turn the concepts in this guide into a practical estimate with DevCalc’s free browser-based tools.

Open related tools →