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

Still have questions?

Can't find the answer you're looking for? Please reach out to our support team.