TOML Tables

Inline Table

name = { first = "Tom", last = "Preston-Werner" }
point = { x = 1, y = 2 }
animal = { type.name = "pug" }

Ignore whitespace

[a.b.c]          # this is best practice
[ d.e.f ]        # same as [d.e.f]
[ g . h .i ]   # same as [g.h.i]
[ j . "ʞ" .'l' ] # same as [j."ʞ".'l']

Multi-nested

[foo.bar.baz]
bat = "hi"

#↓ Equivalent JSON

{
    "foo" : {
        "bar" : {
            "baz" : {
                "bat" : "hi"
            }
        }
    }
}

Dot separated

[dog."tater.man"]
type = "pug"

#↓ Equivalent JSON

{
  "dog": {
    "tater.man": {
      "type": "pug"
    }
  }
}

Array-like

[[comments]]
author = "Nate"
text = "Great Article!"
[[comments]]
author = "Anonymous"
text = "Love it!"

#↓ Equivalent JSON

{
    "comments" : [
        {
            "author" : "Nate",
            "text" : "Great Article!"
        },
        {
            "author" : "Anonymous",
            "text" : "Love It!"
        }
    ]
}

Nested

[table1]
    foo = "bar"
[table1.nested\_table]
    baz = "bat"

Basic

[name]
foo = 1
bar = 2

foo and bar are keys in the table called name

Comments