HOME

TheInfoList



OR:

TOML is a
file format A file format is a standard way that information is encoded for storage in a computer file. It specifies how bits are used to encode information in a digital storage medium. File formats may be either proprietary or free. Some file formats ...
for
configuration file In computing, configuration files (commonly known simply as config files) are computer file, files used to configure the Parameter (computer programming), parameters and Initialization (programming), initial settings for some computer programs. T ...
s. It is intended to be easy to read and write due to obvious semantics which aim to be "minimal", and is designed to map unambiguously to a
dictionary A dictionary is a listing of lexemes from the lexicon of one or more specific languages, often arranged alphabetically (or by radical and stroke for ideographic languages), which may include information on definitions, usage, etymologies ...
. Its specification is
open-source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
, and receives community contributions. TOML is used in a number of software projects, and is implemented in many programming languages. The name "TOML" is an acronym for "Tom's Obvious, Minimal Language" referring to its creator,
Tom Preston-Werner Thomas Preston-Werner (born May 27, 1979) is an American billionaire software developer and entrepreneur. He is an active contributor within the free and open-source software community, most prominently in the San Francisco Bay Area, where he l ...
.


Syntax

TOML's syntax primarily consists of key = value pairs, ection names/code>, and # (for comments). TOML's syntax somewhat resembles that of . INI files, but it includes a formal specification, whereas the INI file format suffers from many competing variants. Its specification includes a list of supported data types: String, Integer, Float, Boolean, Datetime, Array, and Table.


Example

# This is a TOML document. title = "TOML Example" wnername = "Tom Preston-Werner" dob = 1979-05-27T07:32:00-08:00 # First class dates atabaseserver = "192.168.1.1" ports = 8000, 8001, 8002 connection_max = 5000 enabled = true ervers # Indentation (tabs and/or spaces) is allowed but not required ervers.alpha ip = "10.0.0.1" dc = "eqdc10" ervers.beta ip = "10.0.0.2" dc = "eqdc10" lientsdata = ["gamma",_"delta"_[1,_2.html" ;"title="gamma",_"delta".html" ;"title="["gamma", "delta"">["gamma", "delta" [1, 2">gamma",_"delta".html" ;"title="["gamma", "delta"">["gamma", "delta" [1, 2] # Line breaks are OK when inside arrays hosts = [ "alpha", "omega" ]


Use cases

TOML is used in a variety of settings (some related to its creator), such as: * Static site generators like Jekyll and Hugo * Continuous integration on e.g. GitHub and GitLab
Python
programming language

programming language


Comparison to other formats

The following table draws on th
TOML specification
to make a comparison to other popular configuration formats.


Criticism

Since its first release TOML has received several critiques. The following is not a consensus. The HitchDev lists the following points as problematic in TOML: * TOML is verbose; it is not DRY and it is syntactically noisy * TOML's hierarchies are difficult to infer from syntax alone * Overcomplication: Like YAML, TOML has too many features * In TOML the syntax determines the data types ("syntax typing") Th
libconfini
project has since released a more extensive critique of TOML from the INI perspective, listing the following points (among others) as problematic: * TOML lets the configuration file decide about data types (syntax typing), when ''de facto'' it is the client application that decides. Any mismatching type will be either ignored or converted to the expected type (depending on the parser) anyway * TOML re-introduces what human-friendly languages normally try to get rid of: a verbose syntax and the necessity of using quotes for strings * TOML syntax is always
case-sensitive In computers, case sensitivity defines whether uppercase and lowercase letters are treated as distinct (case-sensitive) or equivalent (case-insensitive). For instance, when users interested in learning about dogs search an e-book, "dog" and "Dog" a ...
, despite the fact that there are situations where configuration files ''must'' be case-insensitive (as, for instance, configuration files that map a FAT32 filesystem or HTML tags) * TOML uses square brackets for arrays even though square brackets are already reserved for table names; furthermore any special syntax for arrays brings the language back to syntax typing * A TOML table must be populated in a single step; merging multiple TOML files is problematic * TOML arbitrarily introduces a syntax for dates * TOML allows (but discourages) the
empty string In formal language theory, the empty string, or empty word, is the unique string of length zero. Formal theory Formally, a string is a finite, ordered sequence of characters such as letters, digits or spaces. The empty string is the special cas ...
as a key * TOML's quoting rules introduce confusion between actual strings (free content) and enumeration labels (i.e. choices within closed sets of options) * TOML's rules cannot be inferred from the content, therefore editing a TOML file requires prior knowledge of the language * TOML is backward-incompatible with INI


See also

* INI file *
JSON JSON (JavaScript Object Notation, pronounced ; also ) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other ser ...
- from JavaScript ecosystem *
Recfiles recfiles is a file format for human-editable, plain text databases. Databases using this file format can be edited using any text editor. recfiles allow for basic relational database operations, typing, auto-incrementing, as well as a simple join ...
*
YAML YAML ( and ) (''see '') is a human-readable data-serialization language. It is commonly used for configuration files and in applications where data is being stored or transmitted. YAML targets many of the same communications applications as Exte ...
*
HOCON HOCON, or Human-Optimized Config Object Notation is a format for human-readable data, and a superset of JSON. Uses of HOCON * It is primarily used in conjunction with the Play framework, and is developed by Lightbend. * It is also supported ...


References


External links

* * {{Data Exchange Computer file formats Configuration files Lightweight markup languages Markup languages