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 and value pair separate by equal sign and value must be double quotes Key of type string which accepts characters/ASCII codes/numbers/dashes and underscores
valid keys in toml
following are valid keys in toml
key="value" test_key="value" 956="value" key-1="value" 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
- value without keys are not allowed, for example, =“without key”
- duplicate keys are not allowed
values accept 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
- the 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 the value is not declared, the default value is INVALID
How to declare comments in the toml file.
Like a programming language, It supports comments. Comments are usually ignored by runtime interpreters. Comments are used to specify the explanation of the configuration data. Hash symbol used for specifying comments at the starting character in the line
# this is the comment environment="development"
It supports single-line comments and does not support multi-line comments if you want to specify the multiple lines, each line is marked with the # symbol