1. 8

I see a trend in open source projects lately, which is to use TOML as the preferred configuration and metadata format.

In some cases, I believe YAML would actually be more suitable, but there is a lack of a good, understandable reference page for regular users.

The author of a YAML serialization library for Python wrote this brief YAML reference page to make the language more accessible.

  1.  

  2. 4

    Why do you believe YAML is more suitable than TOML?

    1. 4

      I was going to write a long comment with a few subjective arguments and some code examples, but Reddit comments already did it better.

      Personally, I believe YAML is a better choice as an end-user, as a person who creates/edits config files by myself. But it really depends on the project.

      What I dislike most about TOML is how you have to repeat your “array of table” for every item you have. For example:

      [[menu.main]]
      name = "Home"
      
      [[menu.main]]
      name = "Posts"
      weight = 10
      
      [[menu.main]]
      name = "Contact"
      

      While YAML takes care of the ambiguity using spaces:

      menu:
        main:
          - name: Home
          - name: Posts
            weight: 10
          - name: Contact  
      

      Anyway. As an implementer (if you are writing a parser for these formats), TOML is notoriously easy to parse and write, due to the way it has been designed to be unambiguous; and YAML is notoriously hard to implement, because its specification is heavy and the format has a lot of features (references, anchors, nested values…).