Skip to converter
waynetools
Home / JSON ↔ YAML ↔ TOML

JSON to YAML to TOML Converter

Paste JSON, YAML, or TOML into any panel below. The tool detects which format you pasted and instantly generates the other two, side by side — no dropdown to set, no "convert" button to click.

Direct answer: paste your config into any of the three boxes below — the tool auto-detects JSON, YAML, or TOML and fills the other two panels live. Comments carry over between YAML and TOML (JSON has no comment syntax, so those are dropped there only). Syntax errors show the exact line number instead of a silent blank panel.

Updated 2026-07-11 · Built by Wayne

Detected source:
JSON
YAML
TOML

100% client-side — nothing you paste here leaves your browser. Editing any panel re-derives the other two from it.

What this tool does

Config files show up in JSON, YAML, or TOML depending on the tool that reads them — package.json is JSON, GitHub Actions and Docker Compose are YAML, Cargo.toml and pyproject.toml are TOML. This converter removes the "which format was that command expecting again" step: paste what you have, get the other two immediately, in the same layout, no format picker.

Unlike a one-direction converter, it treats all three formats as equal citizens. Edit the YAML panel and the JSON and TOML panels update; edit the TOML panel instead and the other two follow. Comments attached to a key in YAML or TOML travel with that key when you switch between those two formats — they're only lost going into JSON, because JSON itself has no comment syntax to hold them.

Two worked examples

Input — YAML (Docker Compose style)
service: web
image: nginx:1.27  # pinned version
ports:
  - "80:80"
  - "443:443"
environment:
  DEBUG: false
Output — TOML
service = "web"
image = "nginx:1.27"  # pinned version
ports = ["80:80", "443:443"]

[environment]
DEBUG = false
Input — TOML (Cargo-style)
[package]
name = "demo"
version = "0.1.0"

[[bin]]
name = "cli"
path = "src/main.rs"
Output — JSON
{
  "package": {
    "name": "demo",
    "version": "0.1.0"
  },
  "bin": [
    { "name": "cli", "path": "src/main.rs" }
  ]
}

Notes on lossless-ness

  • Comments survive YAML ↔ TOML round trips (tracked per key/item, including nested ones). They're always absent from the JSON panel since JSON has no comment syntax.
  • TOML has no null. A null field converting into TOML becomes an empty string, since that's the nearest thing TOML's type system allows.
  • TOML's top level must be a table. A JSON array or bare scalar at the root has no TOML equivalent — wrap it in an object, e.g. {"items": [...]}, before converting.
  • Arrays of objects become YAML sequences of mappings, or TOML [[array.of.tables]] blocks — both round-trip back to the same array.

Frequently asked questions

Does this tool upload my data anywhere?
No. Detection, parsing and conversion all run in plain JavaScript in your browser. There's no server call and no network request after the page loads — you can disconnect from the internet and it keeps working.
How does the format auto-detection work?
It tries JSON.parse first (fastest, strictest). If that fails, it tries TOML, which has a distinctive key = value / [table] syntax. If that also fails, it falls back to YAML, the most permissive of the three. Whichever parser succeeds becomes the source, and the other two panels are generated from that result.
Are comments preserved when converting?
Yes, where the destination format supports comments. JSON has none, so comments are always dropped there. YAML and TOML both support # comments, so a comment on a key in your YAML reappears on that same key in the TOML output, and vice versa — including on nested keys and array-of-table entries, not just top-level ones.
What happens with TOML's [[array.of.tables]]?
It maps to a JSON/YAML array of objects, like Cargo's repeated [[bin]] entries. Converting an array of objects back into TOML re-emits it as [[array.of.tables]] automatically, so files like Cargo.toml or pyproject.toml round-trip correctly.
Why does converting JSON to TOML sometimes fail?
TOML requires the top-level value to be a table (an object) — it has no concept of a top-level array or bare scalar. If your JSON root is an array or a plain string/number, wrap it in an object first, e.g. {"items": [...]}, then convert.
Does it handle null the same way in every format?
JSON and YAML both support an explicit null. TOML deliberately has no null type, so a null field converting into TOML is emitted as an empty string, the closest available representation.
How are syntax errors reported?
If your pasted text fails to parse as any of the three formats, the panel shows the error message plus the 1-indexed line number where parsing broke, so you can jump straight to the problem instead of scanning the whole file.

Related tools