Why doesn't JSON support comments?
- Published at
- Updated at
- Reading time
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. :/
If you want to learn more, here's why comments were removed on YouTube.