YAML to TOML
Parse and convert YAML to TOML.
About YAML to TOML
Converts a YAML document directly into TOML, without going through JSON by hand. Handy when a project moves from a YAML configuration to a TOML one, or when a tool only reads TOML.
When you would use it
- Migrating a configuration file from YAML to TOML, for example to pyproject.toml.
- Producing a TOML snippet from a YAML example found in documentation.
- Comparing how the same data looks in both formats.
How to use it
- Paste the YAML into the left field.
- Read the TOML on the right.
- Copy the result.
Things worth knowing
- TOML's rules apply to the result: the top level must be a mapping and null values are dropped. A YAML document that is a list or a scalar at the top level produces no output.
- YAML's implicit typing happens first: an unquoted true becomes a boolean and 1.10 a number before conversion. Quote values in the YAML to keep them as strings.
- Anchors, aliases and merge keys are expanded, so repeated data is written out in full in the TOML.
- Comments are not carried over.
Frequently asked questions
- The error says my JSON is not valid, but I pasted YAML?
- The message is generic: it means the YAML could not be parsed. If the YAML is valid but the output stays empty, the document is probably a list or a scalar at the top level, which TOML cannot represent.
- Why are some keys missing from the TOML?
- Keys whose value was null (or an empty value in YAML, which parses to null) are omitted because TOML cannot represent null.