Tools / Text & Data / YAML / JSON / TOML Converter
Client-side

YAML / JSON / TOML Converter

Convert between YAML, JSON, and TOML in any direction locally in the browser, handling multiline strings and nested arrays for CI and config migrations.

What it does

  • Six directions between YAML, JSON and TOML
  • Anchors and aliases resolved, multiline strings kept
  • Select input and output format independently
  • Parse errors with line and column
  • Runs locally, config files never leave the tab

YAML, JSON and TOML describe the same kind of data (maps, lists, strings, numbers, booleans) with three different syntaxes. This converter reads any one of them and writes any other: pick the input format above the left panel, the output format above the right panel, and click Convert. The six directions run on the Rust libraries serde_yaml, serde_json and toml compiled to WebAssembly, so your Kubernetes manifests, CI pipelines and Cargo.toml files are converted inside the browser and never sent to a server.

The six directions and their dedicated pages

All directions are available from this page. The four most searched ones also have a dedicated page with the formats pre-selected and a guide specific to that pair:

  • YAML to JSON: for feeding a YAML config to a tool or API that only reads JSON. See the YAML to JSON converter.
  • JSON to YAML: for writing Kubernetes, Docker Compose, GitHub Actions or Ansible files from JSON data. See the JSON to YAML converter.
  • TOML to JSON: for inspecting pyproject.toml, Cargo.toml or Hugo configs with JSON tooling. See the TOML to JSON converter.
  • JSON to TOML: for generating a TOML config from structured data. See the JSON to TOML converter.
  • YAML to TOML and TOML to YAML: available here only. Internally they pass through JSON, so the rules of both steps apply.

How to use the converter

  1. Select the input format (YAML is selected by default) and paste your content in the left panel.
  2. Select the output format (JSON by default).
  3. Click Convert. The result appears in the right panel with a status line such as "Converted YAML to JSON", or an error explaining what could not be parsed.
  4. Copy the output with the copy button. If input and output formats are the same, the text is passed through unchanged.

What is preserved and what changes

The conversion goes through a parsed data model, not a text rewrite. The data is preserved; the formatting of the source is not.

  • Comments are dropped. YAML and TOML comments are not part of the data, and JSON has no comment syntax. Keep the original file if the comments matter.
  • Key order: keys in JSON and YAML output are sorted alphabetically. In TOML output, simple keys come first and tables ([section]) follow, as TOML requires.
  • Anchors and aliases (&base and *base) are resolved: the referenced content is copied into each place it is used. The YAML merge key << is not expanded and comes out as a literal key named <<.
  • Multiline strings survive. In YAML output they are written as block scalars (|-), which keeps long scripts and certificates readable.
  • Arrays of objects become arrays of tables in TOML ([[servers]]).

Limits and edge cases

  • One YAML document at a time. A file with several documents separated by --- (common in Kubernetes) is rejected. Convert each document separately.
  • YAML 1.2 typing. The parser follows YAML 1.2, so yes, no, on and off stay strings, and 010 stays the string "010". This avoids the classic "Norway problem" where the country code NO turned into false. Only true and false (also written True or TRUE) are booleans.
  • TOML needs a top-level table. JSON that is an array or a single value cannot become TOML. Wrap it in an object, for example {"items": [...]}.
  • TOML has no null. A JSON or YAML null value makes the conversion to TOML fail. Remove the key or replace the value.
  • TOML dates: a TOML datetime such as 1979-05-27T07:32:00Z becomes, in JSON or YAML, an object with an internal $__toml_private_datetime key holding the date string. Replace that object with the plain string if your target expects one.

Compared with command-line tools

On the command line, yq converts YAML to JSON and back, and Python can do it with PyYAML and the built-in tomllib (which reads TOML but does not write it). Those are the right choice in a script or a CI job. This page is faster for a one-off check during a migration, works on a locked-down machine where you cannot install packages, and gives the same privacy as a local tool.

Privacy: configuration files hold secrets

Config files are where database passwords, API tokens, private registry URLs and internal hostnames end up, sometimes by mistake. Converting them on a website that processes input on its servers exposes those values. Here, parsing and serialization run in WebAssembly in your tab with no network request for your content, which you can verify in the browser's Network panel.

Frequently asked questions

Are my config files uploaded?
No. The conversion runs in your browser through WebAssembly. The content you paste never leaves the page.
Why did my YAML comments disappear?
Comments are not data, so they are lost when the document is parsed. JSON cannot hold comments at all. Keep your commented source file as the reference version.
Can I convert a Kubernetes file with several documents?
Not in one pass. Split the file on the --- separators and convert each document on its own.
Why does JSON to TOML fail with "invalid type: null"?
TOML has no null value. Remove the keys whose value is null, or give them an empty string or a default, then convert again.
Is "yes" converted to true?
No. The parser follows YAML 1.2, where only true and false (in lower, title or upper case) are booleans. If you need booleans in the output, write them as true or false in the source.
Can I convert YAML to TOML directly?
Yes. Select YAML as input and TOML as output. The tool converts through JSON internally, so the TOML limits (top-level table, no null) apply.

Related tools: to tidy or validate the JSON side of a conversion, use the JSON formatter and validator.