Uttir
By Uttir 5 min read

JSON vs YAML vs TOML: Which Should You Use in 2026?

A practical comparison of JSON, YAML, and TOML: syntax, features, readability, tooling support, and when each format is the right choice for config files, data exchange, and APIs.

Use JSON for APIs and any data exchange between systems — it is the lingua franca, every language has a parser, and it has no surprises. Use YAML for human-authored config files (Kubernetes, GitHub Actions, Ansible) where readability matters and the data is mostly static. Use TOML for app-level config (Cargo, pyproject.toml, modern CLI tools) where you want clarity and one-key-per-line. In 2026, TOML is winning mindshare in new projects.

If you've shipped any kind of application in the last decade, you've written a config file. And unless you picked a format deliberately, you probably wrote whichever one your framework handed you and never thought about it again. That works fine until you need to debug a 2,000-line YAML file at 2 AM, or you discover that the JSON spec doesn't allow comments and now you can't figure out which key is which.

This guide compares the three formats you actually see in production today — JSON, YAML, and TOML — and gives a concrete recommendation for each common use case. There's no "best" format; there is a best format for what you're doing.

JSON: the lingua franca

JSON (JavaScript Object Notation) is the format of the internet. It came out in 2001 as a simpler alternative to XML, and it stuck. Every programming language has a parser for it, every HTTP API speaks it, and every developer recognizes the syntax without training.

The shape:

{
  "name": "uttir",
  "private": true,
  "tags": ["tools", "free", "client-side"],
  "limits": {
    "maxFileSize": 10485760,
    "allowedTypes": ["jpg", "png", "webp"]
  }
}

The strengths are real: the spec is short, parsers are everywhere, and the syntax is unambiguous. The weaknesses are also real: no comments, trailing commas are an error, and strings must use double quotes. For anything that crosses a network boundary — REST APIs, GraphQL responses, WebSocket messages, server-sent events — JSON is the right call and there's no close second.

For working with JSON, the JSON Formatter handles pretty-printing, validation, and key sorting. The JSON Validator gives you line and column on every parse error.

YAML: the human-readable config format

YAML ("YAML Ain't Markup Language") was designed for exactly the thing JSON isn't great at: files that humans read and write directly. It uses indentation instead of braces, supports comments, and lets you write a string without quotes most of the time.

The shape (same data as the JSON example):

name: uttir
private: true
tags:
  - tools
  - free
  - client-side
limits:
  maxFileSize: 10485760
  allowedTypes:
    - jpg
    - png
    - webp

YAML is the default for Kubernetes manifests, GitHub Actions workflows, GitLab CI, Ansible playbooks, Docker Compose, CircleCI, and most other DevOps tools you'll touch. If you operate infrastructure, you'll write YAML.

The catch: YAML has footguns. The "Norway problem" (the country code NO gets parsed as boolean false in YAML 1.1), the silent coercion of yes/no/on/off to booleans, and indentation-sensitive errors that don't show up until runtime. The 2021 release of YAML 1.2 fixed the boolean coercion (it now requires explicit true/false), but a lot of tooling still parses YAML 1.1 for compatibility.

The JSON to YAML converter is useful for porting config from one ecosystem to another when you need to move between ecosystems — for pure YAML formatting, the indentation conventions in your editor are usually enough, and most editors have built-in YAML support that handles it.

TOML: the new default for app config

TOML ("Tom's Obvious Minimal Language") was created in 2013 by Tom Preston-Werner (GitHub co-founder) as a response to YAML's complexity. The goal: a format that's easy for humans to write, easy for machines to parse, and unambiguous in every case. It has steadily won mindshare — Cargo (Rust), pyproject.toml (Python), Poetry, modern Node tools, and many newer Go programs all use TOML for their config.

The shape:

name = "uttir"
private = true
tags = ["tools", "free", "client-side"]

[limits]
maxFileSize = 10_485_760
allowedTypes = ["jpg", "png", "webp"]

The strengths: explicit types (no implicit booleans from yes/no), unambiguous syntax (one obvious way to do everything), and table headers ([section]) that make large files navigable. The weaknesses: verbose for deeply nested data, no multiline strings without delimiters, and the file extension is TOML not tomL.

If you're starting a new project in 2026 and need a config file, TOML is the safe default. It's well-supported, easy to read, and your future self (or a new team member) will be able to read it without a tutorial.

Side-by-side: same data in all three

Here's the same configuration in each format, to give you a feel for the trade-offs:

JSON (strict, machine-friendly)

{
  "server": {
    "host": "0.0.0.0",
    "port": 8080,
    "workers": 4
  },
  "database": {
    "url": "postgres://localhost/uttir",
    "maxConnections": 20
  }
}

YAML (human-friendly, less strict)

server:
  host: 0.0.0.0
  port: 8080
  workers: 4
database:
  url: postgres://localhost/uttir
  maxConnections: 20

TOML (explicit, easy to scan)

[server]
host = "0.0.0.0"
port = 8080
workers = 4

[database]
url = "postgres://localhost/uttir"
maxConnections = 20

All three describe the same data. JSON is the densest, YAML is the most compact, TOML is the most explicit about types. None of them is wrong; pick by audience.

When to use which (the decision tree)

Here's a quick rule of thumb that gets it right 90% of the time:

  • API response, request body, message between systems? JSON. Always. There is no scenario where a non-JSON API is the right call in 2026.
  • Kubernetes manifest, GitHub Actions, Ansible, Docker Compose, any DevOps config that humans maintain? YAML. It's the lingua franca of operations, and the tooling expects it.
  • App-level config (your CLI tool, your build script, your library's settings)? TOML. One file, one format, no surprises. pyproject.toml, Cargo.toml, and the modern Node ecosystem all use it.
  • Config in an environment variable or 12-factor app? Doesn't matter — use whatever the framework expects, or set the values via env in the config file and reference them.
  • Tabular data (spreadsheets, data exports)? CSV, not any of these. The CSV to JSON converter or JSON to YAML converter will get you between formats when you need to.

Common gotchas

A few pitfalls that bite everyone eventually:

  • YAML's Norway problem. In YAML 1.1 (still default in some libraries), unquoted NO parses as boolean false. Wrap country codes in quotes: country: "NO".
  • JSON's lack of comments. There are no comments in JSON. If you need them, use JSON5, JSONC, or a different format. Don't try to add them by abusing a key like "_comment" — it works but it's ugly and some parsers will choke.
  • TOML's table headers. Each [section] header creates a new table; nested tables use dotted notation ([parent.child]) or inline tables ({ key = "value" }). Don't mix the two without being consistent.
  • YAML's indentation. Use spaces, not tabs. Two-space indent is the convention. Mixing them in the same file is a syntax error.

Verdict

JSON for data on the wire. YAML for operations config that humans maintain. TOML for app-level settings. If you remember those three rules, you'll pick the right format every time. The cross-format converters on Uttir's data tools page make porting between them a one-click job — no need to remember which parser your environment ships with.

#data-formats#developer-tools#comparison#configuration

New tools and guides, once a week

One short email when something new ships. No tracking, no images, unsubscribe with one click.