Tools › Data
JSON ⇄ YAML ⇄ TOML
Convert between JSON, YAML and TOML in any direction, with 2 or 4 space indents.
About this tool What it's for, how to use it and an example
What it's for
Convert between JSON, YAML and TOML, in any direction. YAML is common in configuration (Docker Compose, Kubernetes, GitHub Actions, Jekyll); TOML is used by Cargo, pyproject.toml and Hugo; JSON is what most APIs and programs produce.
For example, when documentation gives a config as JSON but your tool wants YAML or TOML, or you want to check how a YAML or TOML file is actually being read, convert it here.
How to use it
Paste your text, choose its format under From and the one you want under To, then choose Convert. Choose a 2 or 4 space indent (used for JSON and YAML; TOML output isn’t indented). The formats you chose are remembered in the browser. Use as input moves the result into the input box and sets From to match, ready for another conversion. Long lines aren’t wrapped. If the input has a mistake, the error message says where.
Example
Paste this, choose From JSON and To TOML, and choose Convert:
{"name":"Alice","roles":["admin","dev"],"address":{"city":"London"}}
The result is:
name = "Alice"
roles = ["admin", "dev"]
[address]
city = "London"
Good to know
TOML has no null, so JSON or YAML containing null can’t be converted to TOML; the message names the key. TOML’s top level must be a table of keys and values, so a JSON or YAML array or single value at the top can’t be TOML. TOML dates and times become ISO text (1979-05-27) in JSON and YAML. Comments in YAML or TOML are lost, because the other formats have none, and YAML’s anchors and aliases are expanded into copies of the values they point to. Arrays of objects become [[table]] sections in TOML.
Private: this tool runs in your browser. Nothing you type, paste or choose leaves this page.
Saved you a few minutes? Say thanks with a coffee.
Something wrong with this tool, or missing from it? Report a bug or suggest a feature.