What is a TOML?
TOML
is abbreviated as Tom’s Obvious, Data format serialization language, and it is a new file format.
It is used for specifying data in configurations similar to YAML.
Usually, each software or application has some configuration data, Before the TOML format existed, We used to have a property file with key and value pairs like key=value.
The property files are not suitable when there is a complex structure of configuration.
TOML is suitable for representing data in hash table format and is easy to read and write data with various programming languages.
Advantages of TOML
- It is human-readable for complex configuration and settings
- Support all popular languages - GO, Java, Python, Javascript, etc.
- Support Comments
- Maintainable
- Gain more popularity than other file formats
- Read and write capabilities
- the content of these files looks like Windows Init format
Disadvantages of TOML
- Numbers like NAN and infinity are not supported
- No support for binary data
- Only supports a few data types, not extendable
TOML use cases
- TOML can be used in many types of projects for different purposes
- Configuration and settings of the software applications
TOML file extension
TOML document is grouped in a file with the extension toml
, You can use any IDE or text editor to open this file.
All the popular IDEs support the toml
file extension and also provide plugins to validate the toml
file content
toml data rules
- data in toml files are case-sensitive
- file supports UTF-8 encoding format only
- Supports white spaces, tabs, and newlines ASCII code
MIME format type - application/toml
MIME
is abbreviated as Multipurpose Internet Mail Extensions
.
It is a format specified in request and response that is transferred between client and server across the internet.
Content-Type
and accept
headers in a request object are specified with this format.
Following is the mime type for these documents
application/toml
and request contains the below value for toml
data sending over the internet
Content-type : application/toml
Let’s see some frequently asked questions on TOML
.
How do I view TOML files?
Toml
files are like text files that can be opened in any normal text editor like Notepad or Notepad++.
Basic editors do not provide validation and format of toml
files.
You can use Sublime Text, IntelliJ IDEA, and Visual Studio editors that have rich plugins to format and validate toml
files.
Normal editors in Windows, Apple, and Unix flavors support reading TOML files.
What is TOML used for?
Toml
file is like a normal ini
file in Windows that can be used to support configuration settings in different applications using multiple programming languages.
Spring projects, toml file used to configure environment settings for different environment profiles.
It provides strong typing to make it a configuration with typed values.
Does toml support comments
Comments are useful text to describe the line of code. toml
supports comments using the following syntax. Toml files are easily readable by humans.
Comments make it clean and readable in maintaining configuration in applications.
# profile for development environment
[development]
server = "dev.localhost"