|
Choosing a unified format for configurations is an interesting task, because they all suck a lot (hehe). XML is too verbose to be nice to work with. Plain text files with config flags delimited by newlines lead to the program in the end implementing a small scripting language for config files. JSON is pretty nice, but also a bit clunky. A lot of {:} all the time. Personally, I think the nicest and most expressive way is S-expressions. I'm no lisper, but you have to admit sexprs are expressive, easy to read, and can be run as functions if the program knows lisp. {
"configFiles": "in JSON",
"wouldLook": {"like":"this"}
}
(while sexpr
(could look)
(even nicer))
|
In fact, I hated it because it seemed to be just "another standard" that unnecessarily adds dependency.
But after using Rust, whose package manager forces me to write the package configuration in TOML, I found the format is more like "JSON designed for configuration file." As you said, JSON is full of ':', '{' and '}'. And it is natural because it started from data interchange format, not for handwriting. TOML solves this problem very well IMHO.
Also, unlike XML that requires an external structure to validate the types of the values, TOML values have types, just like JSON.