3 ms·
Yes, trailing commas should work everywhere! JSON is the other one where it annoys me, but luckily I rarely hand-write any JSON anymore (and there are semi-sol
by gregmac 4y ago
Yes, trailing commas should work everywhere!
JSON is the other one where it annoys me, but luckily I rarely hand-write any JSON anymore (and there are semi-solutions for this like json5).
In code I always add trailing commas to anything comma-separated. It makes editing simpler (you can shuffle lines without thinking about commas). In a diff or blame it doesn't show adding a comma as a change.
SQL is the one spot where this doesn't work, and it's a constant foot-gun as I often don't remember until I run and get a syntax error.
- skrtskrt 4y agoJSONC allows comments and trailing commas, but adoption seems to be low. VSCode uses it for configuration, but when I wanted to use it in Python (to add context to source-controlled Elasticsearch schemas) there were only a couple old barely-maintained libraries for parsing.
- yunohn 4y ago> there were only a couple old barely-maintained libraries for parsing. Do they work, though? If it’s a mostly stable standard, doesn’t seem like you’d need a frequently updated parser.
- nicoburns 4y agoYou can often find better maintained libraries for json5, which is a superset of jsonc