json5 / json5-spec

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

make commas optional #50

Closed silphendio closed 6 months ago

silphendio commented 6 months ago

Basically https://github.com/json5/json5/issues/157

I think commas are just visual noise and replacing them with newlines or spaces makes things more readable.

Unlike almost all other configuration or programming languages, json completely ignores whitespace outside of strings. That means there is no reason why whitespace can't fulfill the same purpose as a comma.

There would be less visual noise, the spec wouldn't change much, and unlike with things like Javascript's ASI, there won't be any weird edge cases. Commas and whitespace would just be treated the same.

jordanbtucker commented 6 months ago

Thank you for the suggestion, but one of the tenants of JSON5 is to be a subset of ES5.