Why doesn’t JSON support comments? (#note)

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 p…


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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Why doesn’t JSON support comments? (#note)." Stefan Judis | Sciencx - Tuesday January 24, 2023, https://www.scien.cx/2023/01/24/why-doesnt-json-support-comments-note/
HARVARD
Stefan Judis | Sciencx Tuesday January 24, 2023 » Why doesn’t JSON support comments? (#note)., viewed ,<https://www.scien.cx/2023/01/24/why-doesnt-json-support-comments-note/>
VANCOUVER
Stefan Judis | Sciencx - » Why doesn’t JSON support comments? (#note). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/01/24/why-doesnt-json-support-comments-note/
CHICAGO
" » Why doesn’t JSON support comments? (#note)." Stefan Judis | Sciencx - Accessed . https://www.scien.cx/2023/01/24/why-doesnt-json-support-comments-note/
IEEE
" » Why doesn’t JSON support comments? (#note)." Stefan Judis | Sciencx [Online]. Available: https://www.scien.cx/2023/01/24/why-doesnt-json-support-comments-note/. [Accessed: ]
rf:citation
» Why doesn’t JSON support comments? (#note) | Stefan Judis | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.