IssueRaiser

Not supporting comments in JSON was a huge mistake.

Not supporting comments in JSON was a huge mistake. Yes I'm sure that someone, somewhere has once added comment directives to a file that caused issues. But that's such a rare problem compared to the very real and damaging and annoying problem of not being able to add comments to config files (hello package.json) that it's definitely the wrong choice. XML supports comments and I have not seen a single use of comment directives in it ever. I have seen plenty of comment directives in programming languages, HDLs and so on. But they are usually used as hints, e.g. to linters or to control compiler warnings, and they work perfectly well and cause no problems at all in my experience. You might say that Crockford didn't anticipate JSON being used for config files. Fair enough. But now that it is, it should support comments. My recommendation is to use JSON5 since it has a distinct file extension and fixes some other things about JSON too (e.g. trailing commas, hex constants) without being full on YAML insane.

Posted by IshKebab on Apr 6, 2023, 4:23 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments

support (Software)

Not supporting comments in JSON was a huge mistake.

IshKebabApr 6, 2023, 4:23 PM

Not supporting comments in JSON was a huge mistake. Yes I'm sure that someone, somewhere has once added comment directives to a file that caused issues. But that's such a rare problem compared to the very real and damaging and annoying problem of not being able to add comments to config files (hello package.json) that it's definitely the wrong choice. XML supports comments and I have not seen a single use of comment directives in it ever. I have seen plenty of comment directives in programming languages, HDLs and so on. But they are usually used as hints, e.g. to linters or to control compiler warnings, and they work perfectly well and cause no problems at all in my experience. You might say that Crockford didn't anticipate JSON being used for config files. Fair enough. But now that it is, it should support comments. My recommendation is to use JSON5 since it has a distinct file extension and fixes some other things about JSON too (e.g. trailing commas, hex constants) without being full on YAML insane.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue