3 ms·
> You know what's annoying? Having to remember a dozen-odd JSON-but-not-really config file syntaxes instead of just JSON. That's why YAML is out of the questio
by captainmuon 12y ago
> You know what's annoying? Having to remember a dozen-odd JSON-but-not-really config file syntaxes instead of just JSON.
That's why YAML is out of the question for me. But JSON is too restricted to write it manually (no trailing commas, no comments, no round-trip-safety). What I'd ideally like is to take this Python/JS5 file (differ only in the comment indicator # vs //)
# this is an important comment
obj = {'hello': 'world',
'list': [1,2,3,4,5,]}
...
from configfile import obj
and to turn it into a safe
// this is an important comment
{'hello': 'world',
'list': [1,2,3,4,5,]}
...
obj = parser.loads("configfile.cfg")
It's not that I don't like JSON. Its just that I have a different requirements. When I need JSON, I use JSON. When I need easily editable config files that look like Python or JS (which I can easily remember), I use something like HJSON.
- angersock 12y agoTwo of your issues go away: { "configOption": { "c": "This option is configurable.", "val": 42 } } And now, the comment is round-trip-safe and exists!