Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Gotchas

Some specific things are not easy to describe in just text with a couple examples; therefore this section is for such topics that I feel could use a more thorough or visual discussion.

Field termination within lists

In a list, there are only elements, however, due to the fact that a map is an element, and can contain fields, this leads to:

{
    my-list = [
        {
            something = "foo";
        }
    ]
}

As you can see in the above example, the context is important. my-list has only one element, being a map. As noted in the specification, a map is a container for fields, so any fields within that map need field terminators.

However as you may also notice, the map itself is not terminated, due to it being only an element! It may be useful to think of it as:

Does this value have an identifier (name)?

If it does, it's part of a field; if not, it is an element.

The 'document'

The document is the outer enclosing braces, one at the beginning denotes the start, and the other denotes the end. Strictly speaking, this language could have dropped these from the spec, given that unlike in Nix, they aren't actually necessary here. They have however been kept as part of God for a few reasons:

  • They help simplify the creation of parsers, offering an unambiguous beginning and end
  • JSON data often is also enclosed within an outer set of braces, so it may familiar to those who are used to JSON.