TOML to YAML Format — Numio
Converts a TOML document to YAML. Tables become nested mappings, [[array of tables]] become lists of mappings, and quotes are added only where YAML needs them (for example "2021" stays a string).
Moving settings from a TOML config (Cargo, pyproject, Hugo) to a YAML-based tool such as a CI workflow or Kubernetes manifest.
TOML
YAML
When to use it
- Moving settings from a TOML config (Cargo, pyproject, Hugo) to a YAML-based tool such as a CI workflow or Kubernetes manifest.
- Reading a long TOML file with dotted and nested tables as an indented tree.
How to use
- Paste the TOML document into the left editor, or use the load-file button to open a UTF-8 file.
- If an error appears, use the reported row and column to find duplicate keys or syntax problems.
- Check datetimes and quoted values in the YAML, then copy it.
TOML
# Cargo-style manifest
[package]
name = "demo"
version = "0.1.0"
edition = "2021"
[dependencies]
serde = { version = "1.0", features = ["derive"] }
[[bin]]
name = "cli"
path = "src/main.rs"YAML
package:
name: demo
version: 0.1.0
edition: "2021"
dependencies:
serde:
version: "1.0"
features:
- derive
bin:
- name: cli
path: src/main.rsDetails and limitations
Comments are dropped. Offset datetimes are converted to UTC (2024-01-05T10:00:00+09:00 becomes 2024-01-05T01:00:00.000Z) and milliseconds are added.
Output follows YAML 1.2, so strings like yes and on are written without quotes. YAML 1.1 parsers (for example PyYAML) may read them as booleans; quote them by hand if needed.
Local times such as 09:00:00 are written with milliseconds (09:00:00.000); local dates and date-times keep no time zone.
Runs in your browser (@iarna/toml, yaml, Prettier); inf and nan become .inf and .nan.
FAQ
Are comments kept?
No. TOML is parsed into data first, so comments and blank lines are lost. Copy important comments over manually.
How are [[array of tables]] converted?
Each [[bin]] block becomes one item in a YAML list under bin, as shown in the example.
Why do I get "Can't redefine existing key"?
The same key or table is defined twice, which TOML forbids. The error gives the row and column of the second definition.