Add a JSONC language variant for "JSON with Comments"
See original GitHub issueSimilar to #406, which correctly points out that comments are not permitted in the JSON spec, can a new, very similar language be added that does permit comments and trailing commas?
This is often used in configuration files for (among other things) VS Code and Sublime Text. Github comparison of codefences for json
versus jsonc
:
[
// The foo
{ "foo": [ "baz", 4, true ] },
// The bar
{ "bar": [ "biff", 10, false ] },
]
[
// The foo
{ "foo": [ "baz", 4, true ] },
// The bar
{ "bar": [ "biff", 10, false ] },
]
Right now, I use javascript
for these like #406 suggests, but it is much easier to discriminate keys and values with the JSON highlighting.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Can comments be used in JSON? - Stack Overflow
No. JSON is data-only. If you include a comment, then it must be data too. You could have a designated data element called...
Read more >JSONC is a superset of JSON which supports comments
This is a Go-only implementation, but the concept is portable to any language (hint, hint). JSONC is a superset of JSON which supports...
Read more >JSON With Commas and Comments - Nigel Tao
Summary: JWCC is a minimal extension to the widely used JSON file format with (1) optional commas after the final element of arrays...
Read more >matlab-json-c - File Exchange - MathWorks
A simple parser for JSON with Comments written in MATLAB ... Hence the need for the not-quite-official JSON+C variant.
Read more >JSON with Commas and Comments - Hacker News
Pretty much every language on the planet has JSON parser libraries ... anyway so you can put a few lines to ensure that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Good catch. I just responded to that comment, we’ll see where it goes. 😃
@yyyc514 It would be nice to have that as an option. 🙂