-
Notifications
You must be signed in to change notification settings - Fork 3.7k
JSON Comments #406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
JSON doesn't have comments in it's spec since it is just a representation of data. If you want comments to be highlighted, it is probably best to just use javascript instead of JSON. |
@sourrust Perhaps you're being a little too literal here? Our XML syntax currently covers:
While I think some (most?) of those things are truly XML, HTML is for sure not, and that's a pretty HUGE discrepancy. Much larger than JSON vs JSONC in my opinion. See also C vs C++ being a single syntax... Bash vs Zsh... Awk vs Gawk... ...and I could go on... 😸
Except the Javascript syntax does a much worse job of highlighting JSON because that's not what it was intended for. Any chance your opinion on this one has changed or we'd be more open to this now than we were in 2014? |
I also can't see any reason for not allowing comments in JSON. It won't break highlighting of valid JSON, and will help other purposes. |
Agree. |
I think this could be solved by adding support for JSON5 Summary of JSON5 features compared to JSONThe following ECMAScript 5.1 features, which are not supported in JSON, have been extended to JSON5. Objects
Arrays
Strings
Numbers
Comments
White Space
JSON5 was also mentioned in the PR that tried to add support for comments in JSON: #425 (comment) |
I think this would be a welcome addition. |
Comments in a JSON block are ignored. It would be great to be able to highlight these as well. For example:
The text was updated successfully, but these errors were encountered: