Developer Tools • 5 min read

YAML, JSON and TOML: Choosing and Converting Config Formats

How YAML, JSON and TOML differ, which fits which job, and what can go wrong when you convert between them, with a pre-conversion checklist.

Published: 2026-11-12 • Last Updated: 2026-11-12 • By Mohammed Zawwar Hussain

Interactive Online Tools Referenced in this Guide

Three formats, three personalities

Most software is configured through a text file, and three formats dominate. They hold the same kind of data, which is named values, lists and nested groups, but they feel very different to write.

FormatStrengthsWeak points
JSONStrict, universal, easy for programs to read and writeNo comments, quotes on every key, trailing commas not allowed
YAMLVery readable, comments, compact listsIndentation matters, and some plain values are read as numbers or booleans
TOMLClear sections, comments, simple rules, popular for project settingsDeeply nested data becomes long and repetitive

A good rule of thumb: use JSON when programs exchange data, YAML for human-edited files with lots of nesting such as pipelines and orchestration, and TOML for settings with a few sections.

The same data in each format

Here is one small configuration written three ways.

JSON: {"name": "app", "ports": [80, 443], "debug": false}
YAML: name: app / ports: [80, 443] / debug: false (each on its own line)
TOML: name = "app" / ports = [80, 443] / debug = false (each on its own line)

With the YAML to JSON Converter you paste either format and the tool works out the direction itself. Text that begins with a curly brace or square bracket is read as JSON and written as YAML, and anything else is read as YAML and written as JSON. The TOML to JSON Converter works the same way for TOML.

The classic YAML traps

YAML guesses the type of plain values, which is convenient until it guesses wrong.

  • Numbers that are really text. A value such as 123 is a number, but a postcode or an ID that must keep its form should be quoted as "123".
  • Booleans. true and false are booleans. Some YAML versions also read words such as yes and no this way, which has bitten country codes (NO for Norway).
  • Colons. A string that contains a colon followed by a space, like "x: y", must be quoted or it is read as a nested key.
  • Empty values. A key with nothing after it is null, not an empty string.
  • Indentation. Use spaces, never tabs, and keep the same step throughout a block.

When the converter writes YAML, it quotes strings that could be misread, including numbers, true and false, text with a colon and space, and empty text. It writes empty lists and maps as [] and {}.

What the converters support and what they do not

The converters on ProIT are lightweight tools for ordinary configuration files. Be clear about the limits before you rely on them.

  • Supported in YAML: nested maps, lists, quoted and plain strings, numbers, true, false, null, empty [] and {}, simple inline lists and maps, and trailing comments.
  • Not supported in YAML: anchors and aliases (&name and *name), multi-line block text written with | or >, tags, and several documents in one file. Handle these by hand or with a full YAML library.
  • Comments are lost. JSON cannot store them, so converting YAML or TOML to JSON drops every comment.
  • TOML: common keys, tables and arrays are handled. Test unusual constructs before using the result.

Both tools process the text on ProIT’s server for the request, so do not paste secrets such as API keys or passwords.

A checklist before and after converting

  1. Back up the original file.
  2. Remove anchors, aliases and multi-line blocks, or plan to rebuild them.
  3. Note any comments you want to keep and copy them somewhere, since they will not survive a conversion to JSON.
  4. Convert, then compare the result with your original expectations. The File Diff Checker can compare two versions: paste the first, a line containing only three dashes, and then the second. It aligns matching lines first, so one inserted line does not mark everything after it as changed.
  5. If the JSON will be validated, create a starting schema with the JSON Schema Generator. It marks every key in your sample as required, so remove optional keys from the list.
  6. Load the converted file in the real application or a test environment before using it for real.

Choosing a format for a new project

If you are starting a project and have a choice, ask three questions. Who edits the file: people, programs or both? How deeply nested is the data? Does your tool already expect a format? Following the format your framework or deployment tool uses is almost always the right call, because examples, editor support and error messages will all match it.

For files that people review in pull requests, readability and comments count for more than strictness, which favours YAML or TOML. For data that moves between services, JSON’s strict rules make mistakes easier to catch. Whichever you pick, keep one format per purpose and convert only when you must, because every conversion is a chance to lose a comment or change a type.

After converting a file you plan to keep, read it through once and run it in a test setting. A conversion that looks right can still change meaning, such as a quoted number turning into a plain one.

Frequently Asked Questions

Is YAML a superset of JSON? ↓
In practice most JSON is valid YAML, so a JSON file can usually be read by a YAML parser. The reverse is not true.
Why did my comments disappear? ↓
JSON has no comment syntax. Converting from YAML or TOML to JSON drops them.
Which format is best for configuration? ↓
It depends on the tool you use. Follow what your software expects, and prefer the format your team finds easiest to read and review.
Can I convert a file with anchors? ↓
Not with these tools. Anchors, aliases and block scalars are not supported, so expand them first.