JSON Syntax
Can json have comments?
No, standard JSON does not support comments. The JSON specification intentionally excludes comments to keep the format simple and unambiguous. This design decision ensures JSON remains purely a data interchange format, not a configuration language. However, some JSON parsers and variants like JSON5 or JSONC (JSON with Comments) allow comments for configuration files. In standard JSON, attempting to add comments using JavaScript-style syntax will cause parsing errors. Developers often work around this limitation by adding a special key like "_comment" with string values, though this clutters the actual data. For configuration files needing comments, consider using formats like YAML or TOML, or use JSON5 which supports comments while maintaining JSON compatibility.
Last updated: December 23, 2025
Related Questions
Can json have duplicate keys?
Learn whether JSON can have duplicate keys, what happens when they occur, and why you should avoid them for data integrity and predictability.
Can json use single quotes?
Find out if JSON can use single quotes. Learn about JSON's strict double-quote requirement and why it differs from JavaScript syntax.
Can json start with array?
Discover if JSON can start with an array. Learn about valid JSON structures, top-level arrays, and when to use them in your APIs.
Still have questions?
Can't find the answer you're looking for? Please reach out to our support team.