My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Why did Douglas Crockford remove comments from JSON?

Juanita Sutton's photo
Juanita Sutton
·Jul 30, 2016

This is what Douglas Crockford said about removing comments from 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.

What does he mean by "people using comments in JSON, to hold parsing directives"? Am I correct in assuming it means giving directions to the parser? Any idea on how that would have been done, and the cons for doing so, and how would it have destroyed interoperability?

Sourced from https://plus.google.com/+DouglasCrockfordEsq/posts/RK8qyGVaGSr