This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis
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.
Reply to Stefan
This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis
Stefan Judis | Sciencx (2023-01-24T23:00:00+00:00) Why doesn’t JSON support comments? (#note). Retrieved from https://www.scien.cx/2023/01/24/why-doesnt-json-support-comments-note/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.