Fix JSON Syntax Errors
Compare broken and corrected JSON examples for trailing commas, single quotes, and comments.
Remove the trailing comma
JSON allows commas between items, not after the final value in an object or array.
Invalid JSON
{"name":"Ada","ready":true,}Corrected JSON
{"name":"Ada","ready":true}Use double quotes for keys and strings
JSON requires double quotes around object keys and strings. Numbers, true, false, and null do not need quotes.
Invalid JSON
{name:'Ada'}Corrected JSON
{"name":"Ada"}Remove comments
JSON does not support // or /* */ comments. Remove them before validating. Keep // inside quoted URLs: those characters are part of the string.
Invalid JSON
{"count":3 // number of items
}Corrected JSON
{"count":3}Check the reported position and the line before it
An error position marks where the browser noticed a problem. A missing comma or unclosed quote earlier in the input may be the cause. Paste the input into the JSON formatter and inspect both lines.
Formatting does not check meaning
Only spacing and line breaks change. Large numbers, repeated keys and input order are preserved. Valid syntax does not check dates or required fields. Check the requirements of the service using the data.
Tools used in this guide
Sources
Reviewed: