3 ms·
> For me JSON comes close to ideal, if comments were part of the spec I'd be hard pressed to want anything else for general purpose config files. ie. YAML. Wri
by stubish 4y ago
> For me JSON comes close to ideal, if comments were part of the spec I'd be hard pressed to want anything else for general purpose config files.
ie. YAML. Write your JSON with comments and parse it with a YAML parser. Most decent libraries spit out readable YAML or even JSON if you tweak it to always quote strings.
- inferiorhuman 4y agoNo, definitely not YAML. There is way too much complexity with YAML.
- stubish 4y agoThere is only way too much complexity with YAML if you try to use it. JSON-with-comments makes perfectly good YAML if you like that. Nobody forces you to allow the more esoteric features into your code base. You don't even need to know they exist. You can even use a library like StrictYAML if you don't trust your coworkers to be sensible.
- inferiorhuman 4y agoGreat, now whoever uses your program has to wonder what subset of YAML is supported. JSON's advantage is that it's simple, there's not much to support so you get consistent implementations more readily.