Skip to content

JSON ⇄ YAML

Converts either way, preserving key order and choosing block or flow style for the YAML side.

Converts between YAML, JSON and TOML in any direction, in the browser. The parsers are written for this site rather than pulled from npm, which is why the page can list exactly what it refuses — anchors, tags, multi-document streams — instead of mis-reading them quietly.

🔒 Runs entirely in your browserjsonyamlconvert
From
Reading it as YAML.
To

Input

Drop a .yaml, .json or .toml file

Read in this tab. Nothing is uploaded.

JSON out

Written here rather than pulled from npm, which means the subset is chosen rather than inherited. Anything on this list is refused by name instead of being mis-read.

How to use it

  1. Paste the config

    The format is detected from the text, and the label under the picker says which one it decided on. Override it if the guess is wrong — a JSON file is also valid YAML, so a `{ }` document can go either way.

  2. Pick the target

    YAML for a Kubernetes manifest or a CI file, JSON for anything that gets parsed by a program, TOML for a Rust or Python project file.

  3. Read the warnings, not just the output

    A conversion that succeeded can still have changed meaning — a `null` dropped on the way into TOML, a `yes` read as the string it is under YAML 1.2. Those appear in a note under the output rather than being hidden.

  4. Open the scope list when something is refused

    The collapsed section at the bottom names every construct these parsers do not handle, and why. A refusal points at that list instead of failing with a parser error you would have to interpret.

Common questions

Why are my anchors and aliases refused?

Because expanding `*base` correctly means implementing YAML’s merge semantics, and getting that subtly wrong produces a file that looks right and deploys something else. Expanding them by hand before pasting is reliable; this guessing is not. The same reason covers `<<: *base`.

Why did `yes` become a string?

Because YAML 1.2’s core schema says it is one — only `true` and `false` are booleans. YAML 1.1 parsers, including some still in production, read it as a boolean. The difference is announced in the warnings when it occurs, because it is exactly the kind of thing that changes a deploy.

What happens to a `null` on the way to TOML?

It is dropped and a warning says so. TOML has no null value at all, so the choices were to omit the key or to invent a placeholder, and inventing one would put a literal `"null"` string into somebody’s config.

Are comments preserved?

No. The conversion goes through a data model, and comments are not data — JSON has nowhere to put them at all. If you need the comments, the YAML and TOML formatters on this site re-indent in place and keep them.

Feed it from

Next

These accept what this tool produces, so the result can go straight in.