Validating sgml parser
Arguments against comments are shallow, and any textual data format should allow for comments, regardless of implied intended usage (nothing spec suggest JSON can not be used elsewhere, fwiw)If JSON is to have universal acceptance (which it basically does) then it should have universal application.
Example: JSON can serve as an application configuration file. I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability.
So I made my own implementation that does the same thing: gist.github.com/1170297 .
So, you might use it like: When I released it, I got a huge backlash of people disagreeing with even the idea of it, so I decided that I'd write a comprehensive blog post on why comments make sense in JSON.
I admire your gumption, but you're kinda re-inventing YAML.
If you want lot's of flexibility and human readability, use YAML (don't actually: stackoverflow.com/questions/450399/…) or stick with curmudgeony, yet unambiguous JSON.
If you'd like to annotate your JSON with comments (thus making it invalid JSON), then minify it before parsing or transmitting.
Crockford himself acknowledged this in 2012 in the context of configuration [email protected]: When it comes to formal grammars, there must be something that explicitly says that they are allowed, not the other way around.
Search for validating sgml parser:
It includes this notable comment from the creator of JSON: Suppose you are using JSON to keep configuration files, which you would like to annotate. Then pipe it through JSMin before handing it to your JSON parser.