Why comments are removed from JSON



Comments in JSON

According to Douglas Crockford (creator of JSON):

These were the reasons for removing comments:

1. comments turned out to not be very useful.
2. comments were the most difficult feature to support in JSON parsers. By removing comments, support for JSON in other languages became much easier.
3. removing comments aligns JSON more closely with YAML, allowing YAML to become a JSON superset. Generally, standards tend to splinter. It is interesting to see these two merging.
4. I saw examples of comments used to carry information, with an expectation that applications would have to have custom comment parsers and generators. That was not a pattern that I wanted to encourage.

As I have said before, I don’t anticipate any further changes to JSON. I think stability is now the most important feature.



He again given some more reasons for removing comments:

“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.”


References:

https://plus.google.com/+DouglasCrockfordEsq/posts/RK8qyGVaGSr
https://groups.yahoo.com/neo/groups/json/conversations/topics/156