About the YAML to TOML Converter
TOML is the configuration format of Rust's Cargo, Python's pyproject.toml and static site generators such as Hugo, all of which also accept YAML in some contexts. Converting between them is mostly about representing nesting: TOML uses [table] headers for nested mappings and [[array]] headers for lists of mappings. This converter emits those, and uses inline tables for small mappings inside arrays.
Scalars are typed the TOML way: strings quoted, numbers and booleans bare. Null has no TOML equivalent and is written as an empty string, which is the least surprising fallback; review those values. Key order follows the YAML. The top level must be a mapping, since a TOML document is always a table.
Round-tripping through JSON is possible with YAML to JSON, but this direct conversion produces the table layout a person would write.
How to use
- Paste YAML with a mapping at the top level.
- Copy the TOML.
- Check any values that were null in the YAML.
Common questions
- Why does it reject a top-level list?
- TOML documents are tables. Wrap the list under a key such as items:.
- How are nested lists of objects written?
- As [[array]] headers, one per item, which is the standard TOML form.
- Are dates preserved?
- YAML timestamps are written as TOML datetime strings in ISO format.