[[designers]]
name = Guido
lang = Python
[[designers]]
name = Larry
lang = PerlThat all said, for flatter schema's I do personally think TOML is more readable than it's JSON, YAML and XML counterparts. If there is one thing I did like about Windows back when I used to run it, it was the syntax of INI files (which TOML was heavily influenced by).
Ultimately though, there is no perfect solution for all problems.
Yes. But for nested data, I find TOML becomes the least readable and I have to fall back to YAML or JSON.
Maybe we need just one more ML...
I loathe YAML for readability. When I'm 2 pages down on a yaml tree I have no clue how many indents exist before what I'm working on. Likewise, when I scroll up, I quickly lose track of what the actual parent to the data I was working on is. I've found it to be an absolute mess.
JSON doesn't even fit for me, because it's not human intended (imo). Being able to document (comments) configuration is a requirement for me on any config language.
Still there FWIW.
For the most part the language seems like a smarter slightly more flexible INI which I like (although there's no real standard for INI, most formats don't allow for nested arrays or tables,) but why embrace bracket notation for arrays, but not a keyed syntax with the same brackets for tables?
Something like this would have been be a lot cleaner to me:
[designers]
[name = Guido, lang = Python]
[name = Larry, lang = Perl] {
"designers": [
{"name": "Guido", "lang": "Python"},
{"name": "Larry", "lang": "Perl"}
]
}This JSON is also much more readable than the “dot attribute” Toml syntax too, which I think is one of the least intuitive and hardest to read ways of creating nested data structures, certainly vastly less readable than the equivalents in YAML or JSON.
I’ve never understood why anyone would say Toml is easier to read than YAML or JSON. It’s drastically harder to read and more confusing.
[site]
name = "My Great Website"
url = "https://example.com"
author = "Watts Martin"
email = "foo@bar.com"
links = [
{ name = "tom", url = "http://tom.example.com" },
{ name = "bob", url = "http://bob.example.com" }
]
[database]
server = "localhost"
username = "dbuser"
password = "dbpassword"
Than one that looks like this: {
"site": {
"name": "My Great Website",
"url": "https://example.com",
"author": "Watts Martin",
"email": "foo@bar.com",
"links": [
{ "name": "tom", "url": "http://tom.example.com" },
{ "name": "bob", "url": "http://bob.example.com" }
]
},
"database": {
"server": "localhost",
"username": "dbuser",
"password": "dbpassword"
}
}
Semantically, I just find the first one clearer and more intuitive. (The links are really only the dubious part.)The equivalent YAML doesn't look bad:
site:
name: My Great Website
url: 'https://example.com'
author: Watts Martin
email: foo@bar.com
links:
- name: tom
url: 'http://tom.example.com'
- name: bob
url: 'http://bob.example.com'
database:
server: localhost
username: dbuser
password: dbpassword
...but the significant whitespace makes it somewhat more fragile, particularly in those pesky links.I can agree Toml is sometimes better than YAML, but I cannot agree it is better than JSON. For me JSON is so simple, so easy to read, it has the nice feature of preventing comments and multi-line strings to keep things extremely simple and to enforce that documentation about the values in the file has to be located outside the file, as it absolutely should (documentation should be at the site that uses the config/param file, not inside it).
Plus, I find JSON indentation to be a real joy to assist with reading and seeing the nested structure. That indentation is optional in Toml, but I think pretty much always the use of that indentation ought to be enforced as a convention for people using Toml. Lacking the indentation is really not good for config / parameter files.
"YAML Ain't Markup Language"