json5 / json5-spec

The JSON5 Data Interchange Format
https://spec.json5.org
MIT License
50 stars 10 forks source link

Feature: constant names (unquoted string literals) #26

Closed mindplay-dk closed 4 years ago

mindplay-dk commented 4 years ago

I just thought of a way to further reduce the noise in configuration files and the like.

What if we allowed unquoted string literals?

For example:

{ foo: bar }

That's not a JS feature, but it is JS compatible syntax - it merely presumes bar is a const, which has been predefined with the value "bar".

Thoughts?

jordanbtucker commented 4 years ago

Thanks for the suggestion, but any features that are incompatible with ES5 will not be implemented.