3 ms·
It exists: https://json5.org/ https://json5.org/ However I think it goes too far. E.g. why support single quoted strings? That just makes parsing harder. I pr
by IshKebab 6y ago
It exists: https://json5.org/ https://json5.org/
However I think it goes too far. E.g. why support single quoted strings? That just makes parsing harder.
I prefer the format Microsoft uses in VSCode and Typescript - JSONC. It's just JSON but with trailing commas and comments. The downside is it isn't obvious when something is JSON and when it is JSONC because they use the same extension.
- crehn 6y ago> why support single quoted strings? That just makes parsing harder. And something that a lot of language designs ignore: it makes writing harder and unnecessarily contentious. People will use them inconsistently, which has the usual effects any inconsistency has on cognitive load: causes others to question why/how/where.
- olliej 6y agoWhile there are many things that make any change to json changes challenging, single vs. double quote really isn’t a problem, the JSC JSON parser supprots them at an implementation level as it is also used for jsonp insanity, it’s just that in pure JSON mode (eg JSON.parse) it doesn’t allow single quotes or a few other similar “real” js language features it supports for the sake of jsonp