3 ms·
it's true JS doesn't support this, and it's also true that any JSON that supported it would therefore no longer be _JavaScript_ object notation. However, it's
by ledauphin 6y ago
it's true JS doesn't support this, and it's also true that any JSON that supported it would therefore no longer be _JavaScript_ object notation.
However, it's equally true that a better language and object notation would support non-string scalar keys.
- kevingadd 6y agoJavaScript wouldn't be able to consume those resulting objects, so it would be pretty diminished as an alternative to JSON. Object keys are all strings.
- xpe 6y agoI can see why you want non-string scalar keys. In general, I do too. (I'm writing a data language that has them.) However, I don't think it is useful to prod JSON (or a variant) to go in this direction.
- pseudalopex 6y agoWhy not?
- xpe 6y agoJSON is extremely closely linked with JavaScript. Trying to move it in a different direction, in my opinion, would require a lot of effort, without much benefit, and is unlikely to succeed.
- pseudalopex 6y agoJSON is used lots of places JavaScript isn't. It hasn't been closely linked with JavaScript since people realized eval is dangerous. People are more interested in JSON derivatives like JSON5 or Ion than more complex languages like Dhall in my experience.
- xpe 6y agoAll fair points. Dhall is new to me. Would you tell me more about other configuration languages you seen? I often use TOML myself.