Guide

YAML vs JSON vs TOML: Choosing a Config Format

· 6 min read · By the Drop and Open team

Almost every tool reads a configuration file. These are the three formats you will meet most often.

JSON

JSON is strict and universal. Every language can parse it, but it does not allow comments and gets noisy with all the quotes and braces.

YAML

YAML is easy on the eyes, supports comments and is used by Kubernetes, Docker Compose and CI systems. Indentation is part of the syntax, so a misplaced space changes meaning. Some values, such as no or on, may be read as booleans.

TOML

TOML uses explicit key = value pairs and tables. It is less sensitive to whitespace than YAML and comfortable for people to edit, which is why Rust and Python projects chose it.

The same data three ways

FormatExample
JSON{"name": "app", "port": 8080}
YAMLname: app and port: 8080 on two lines
TOMLname = "app" and port = 8080 on two lines

Comparison

JSONYAMLTOML
CommentsNoYesYes
Whitespace sensitiveNoYesNo
Best forAPIs, data exchangeInfrastructureApp settings
RiskVerboseIndentation bugsLess common tooling

How to pick

Follow your ecosystem. If the tool expects YAML, use YAML. If you are free to choose and humans will edit the file, TOML is a good default. If machines write it, use JSON.

Read a config file

YAML, TOML, INI and JSON open instantly as text.

Open a YAML file

Related file guides

Keep reading

Guide

Online File Viewer or Desktop Software: Which Should You Use?

When a browser-based viewer is enough and when you need an installed program, with a simple decision guide.

5 min read
Guide

File Extensions Explained: .pdf, .docx, .xlsx and More

A plain-language guide to common file extensions, which programs open them, and how to spot a suspicious one.

7 min read
Guide

JSON vs CSV vs XML: Which Format Should You Use?

A clear comparison of three common data formats, with examples of when each one fits and how to read them.

6 min read