Skip to main content

Syntax Rules

Each config file contains zero or more sections containing zero or more entries:

[Section1]
key1 = 1

[Section2]
key1 = 2

Unicode escapes can be used in values.

key1 = \u0070\u0075\u0062\u006c\u0069\u0063

Comment lines start with the '#' character and can be placed on lines before sections and entries:

# A comment about this section
[Section1]

# A comment about this entry
key1 = 1

Comments can also be placed on the same line as entries:

key1 = 1  # A comment about this entry

Values containing '#' must be escaped to prevent identification as a comment character:

valueContainingPound = Value containing \u0023 character

Likewise, '' should be escaped to prevent confusion with unicode escapes.

Values containing newlines can span multiple lines.

Subsequent lines start with a tab character.

multiLineValue =
line 1,
line 2,
line 3

When retrieved, the above translates to "line1,\nline2,\nline3".

  • Leading and trailing whitespace on values are ignored.
  • Whitespace is not ignored within multi-line values (except for the leading tab character on each line).
  • Blank lines can be used anywhere in the file.
# A comment line

# Another comment line

[Section1]
...

Values located before any sections are considered part of the no-name section, meaning they are accessed simply by key and not section/key.

# Top of file

# Use config.getString("key1") to retrieve.
key1 = val1

# The first section
[Section1]

# Use config.getString("Section1/key2") to retrieve.
key2 = val2

Section and key names must be at least one character long and not consist of any of the following characters:

/ \ [ ] = #

Whitespace in section and key names is technically allowed but discouraged.