Since this question keeps popping up around me every now and then, despite JSON being around for like 25 years now, this statement from the original designer Douglas Crockford:
[Wayback/Archive] Douglas Crockford – Google+ – Comments in JSON …
I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn’t.
Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser.
Yup, Google+ has been dead for more than 6 years now, so it is important to quote these insights for posterity to find them back.
Related:
- [Wayback/Archive] JSON home page on
json.org - [Wayback/Archive] RFC 4627: The application/json Media Type for JavaScript Object Notation (JSON)
- [Wayback/Archive] RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format
Via: [Wayback/Archive] Can comments be used in JSON? – Stack Overflow with several answers mentioning the above G+ post.
Query: [Wayback/Archive] json comment – Google Search
--jeroen





