Published at
Updated at
Reading time
1min

Did you ever curse the JSON data format for not allowing comments and wondered what the heck? Yeah, same here.

Surprisingly, JSON, in its initial spec, did allow comments, but comment support was removed for three reasons:

  • People put parsing instructions into comments breaking portability across platforms and languages.
  • Comments introduced complexity that might not be needed for a data format.
  • The JSON creators wanted it to be compatible with early YAML versions.

It's a bummer because JSON outgrew its serial data use case, and it's widespread to have JSON config files these days. :/

Pawel Grzybek pointed out that the lack of comments and other features led to the JSON5 spec, which aimed to be a JSON extension suitable for config files and was adopted by VS Code and many other software products today.

If you want to learn more, here's why comments were removed on YouTube.

If you enjoyed this article...

Join 5.4k readers and learn something new every week with Web Weekly.

Web Weekly — Your friendly Web Dev newsletter
Reply to this post and share your thoughts via good old email.
Stefan standing in the park in front of a green background

About Stefan Judis

Frontend nerd with over ten years of experience, freelance dev, "Today I Learned" blogger, conference speaker, and Open Source maintainer.

Related Topics

Related Articles