Skip to content
Burrows Tools

YAML to JSON Converter

Paste a YAML config, get JSON back. Anchors and aliases are resolved, and that <<: *defaults line docker-compose, GitLab CI and Ansible use to share a block gets folded into the object it belongs to instead of arriving as a strange key of its own. A file holding several documents separated by --- becomes a JSON array, one entry each. Reading follows YAML 1.2, so no, yes, on and off stay the words they look like; open the file with a %YAML 1.1 directive and you get the older rules back. A document built to expand into far more data than it looks like is refused with an explanation rather than run. Your config stays in this tab, which matters when it's full of real hostnames and keys.

Converted in your browser — the text never leaves this tab and nothing is uploaded.

Paste your YAML and choose Convert to JSON.

Need the other direction? Convert JSON to YAML

Converting YAML to JSON

  1. Paste your YAML. Comments and anchors are both fine.
  2. Choose 2 or 4 spaces of indentation, or Minified for one dense line.
  3. Press Convert to JSON, then read the notes under the button. They cover anything YAML can say that JSON can't.
  4. Copy the result, or download it as a .json file.

Frequently asked questions

Are anchors and merge keys supported?
Yes. An alias expands to whatever its anchor holds, and a merge key (<<: *defaults) folds into the map that uses it, so a docker-compose file converts into the object its own tooling would build. Expansion is bounded: a document whose anchors multiply each other, the billion-laughs shape, is refused rather than expanded.
Why is no still the string "no" and not false?
Because this reads YAML 1.2, where only true and false are booleans. YAML 1.1 also read no, yes, on, off, y and n that way, which is the Norway problem: the country code NO parsing as false. If your file needs the old rules, start it with a %YAML 1.1 directive.
What about a file with several --- documents?
Every document is converted and the result is a JSON array in file order, with a note saying how many there were. JSON has no document separator of its own, so an array is the only way to carry more than one.
Can YAML hold things JSON cannot?
A few. .nan and .inf become null, !!binary becomes base64 text, a !!set becomes an array and an !!omap becomes an object, and each one is called out in a note. A tag this converter doesn't know is left as the plain text it wraps. No tag can execute anything here.
Is my file uploaded?
No. Parsing and conversion both run in your browser, so a config full of internal hostnames and keys never goes anywhere. The page works offline once it has loaded.