How can I add comments in JSON?
Learn how to work around the lack of comment support with tips for creating structure-specific comments that won’t be rejected by the compiler.
Web developers at any skill level will recognize how important proper documentation is in their code. While JSON has become much more than the data interchange format it was originally designed for, it does not yet permit commenting. So what is a JSON developer to do?
McPeak will teach you two workarounds to this problem as well as the advantages and drawbacks to each. The first option presented is an external tool, JSMin. By stripping the code before publishing for production, comments are removed with the added bonus of smaller file sizes. However this is not ideal for those who work with dynamically generated JSON. As an alternative, McPeak shows us how to use built-in tools to make structure-specific comments that won’t be rejected by the compiler.