TOML Syntax

TOML file contains the documents each document contains the syntax specified as per TOML supported rules. Each document or line contains key and value pairs Following is the syntax

key= "value"

key and value pair are separated by equal sign and value must be double quotes Key of type string which accepts characters/ascii codes/numbers/dashes and underscore

valid keys

following are valid keys

 key = "value" #keys with spaces are allowed
"key" = "value" # quoted keys are valid
dev.db.url="localhost" # keys contains dotted symbol are allowed for grouping

Invalid keys

  • value without keys are not allowed, for example, =“without key”
  • duplicate keys are not allowed

value types

values accepts of types string,integer,Float,Boolean,Date types,Array and tables only

TOML data key and value pair rules

  • value must be enclosed in double quotes
  • key and value pair declared in single line only
  • spaces before or after key and value pairs are ignored
  • key is of type string and value supports limited values of different types
  • new line must be followed by key and value pairs in a single line
  • if value is not declared, default value is INVALID

comments declaration

Like a programming languages, It supports comments, Comments are usually ignored by runtime interpreters. Comments are useful to specify the explanation about the configuration data. Hash symbol is used for specifying comments at the starting character in the line

# this is comment

It supports single line comments and does not supports multi line comments if you want to specify the multiple lines, each line is marked with # symbol