4 ms·
> 2) comments Per Douglas Crockford, the creator of JSON, comments were an anti-feature: > I removed comments from JSON because I saw people were using them t
by throw0101a 6y ago
> 2) comments
Per Douglas Crockford, the creator of JSON, comments were an anti-feature:
> 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.
* https://web.archive.org/web/20120507093915/https://plus.google.com/118095276221607585885/posts/RK8qyGVaGSr https://web.archive.org/web/20120507093915/https://plus.goog...
Discussion on the post (2012):
* https://news.ycombinator.com/item?id=3912149 https://news.ycombinator.com/item?id=3912149
Remember: JSON was designed primarily as a data exchange format between computers.
- MichaelMoser123 6y agoProcessing instructions can always be added as a special name value entry, that wouldn't be a good reason to get rid of name value pairs
- enricozb 6y agoThis is what I figured would be the reason to remove comments, because they would hold some other non-human information. It's unfortunate that people do this. The main reason for comments for me would be for config files, which maybe shouldn't be in JSON anyways.
- throw0101a 6y ago> The main reason for comments for me would be for config files, which maybe shouldn't be in JSON anyways. I think this is a bit of 'over reach' in what JSON was intended to do, so it's perhaps not surprising that there may be some things 'lacking' for that purpose.