Skip to content
Burrows Tools

YAML to JSON Converter

Paste a YAML config and get JSON you can hand to an API, a test fixture, or a tool that never learned YAML. Anchors and aliases are resolved, and the merge keys docker-compose, GitLab CI and Ansible use to share a block — that <<: *defaults line — are folded into the object they belong to instead of arriving as a strange key of their own. A file holding several documents separated by --- becomes a JSON array with one entry per document. Reading follows YAML 1.2, where no, yes, on and off are the words they look like rather than booleans, unless the file opens with a %YAML 1.1 directive asking for the older rules. Documents built to expand into far more data than they look like are refused with an explanation rather than run. Everything happens in this tab: no upload, no server, and no copy of your file anywhere.

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

How to use the yaml to json converter

  1. Paste your YAML, including comments and anchors — both are handled.
  2. Choose 2 or 4 spaces of indentation, or Minified for one dense line.
  3. Press Convert to JSON, then read any notes under the button — they cover anything YAML can say that JSON cannot.
  4. Copy the result, or download it as a .json file.

Frequently asked questions

Are anchors and merge keys supported?
Yes. An alias is expanded to whatever its anchor holds, and a merge key (<<: *defaults) is folded 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 instead of 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 as booleans, which is the Norway problem. If your file needs the old rules, start it with a %YAML 1.1 directive and they are applied.
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 separator of its own, so an array is the only honest way to carry more than one document.
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. Tags this converter does not know are left as the plain text they wrap — no tag on this page can run anything, whatever it claims to be.
Is my file uploaded?
No. Parsing and conversion both happen in your browser. Nothing is sent to a server, so this is safe to use on a config full of internal hostnames and keys, and it works offline once the page has loaded.