YAML ↔ JSON Converter
Multiple --- separated YAML documents become a JSON array.
About YAML ↔ JSON Converter
Paste YAML to get JSON, or JSON to get YAML. Multi-document YAML files — the kind Kubernetes manifests and docker-compose overrides use — convert to a JSON array; everything runs locally, so a config file with real hostnames, ports or environment values never has to leave your machine.
YAML and JSON describe the same kind of data — nested objects, lists and scalars — but neither reads comfortably as the other, and config files routinely need to move between the two: a Kubernetes manifest, a GitHub Actions workflow, or an app config that a script needs to consume as JSON. This tool converts either direction in your browser.
A single YAML file can contain multiple documents separated by a `---` line — very common for Kubernetes manifests and Docker Compose overrides. Converting one of these produces a JSON array, one entry per document, rather than only the first one. The reverse isn't quite symmetric on purpose: a JSON array converts to one YAML sequence, not back into separate `---` documents, since most JSON arrays are just lists of values, not a stack of separate documents.
Parsing is done with `js-yaml`, the same library used across most of the JavaScript ecosystem, rather than a hand-rolled parser — YAML has real edge cases (anchors and aliases for repeated values, quoting rules, multi-document streams) where a subtly wrong parser produces output that looks fine but is quietly incorrect, which is a worse failure than an obvious one.
What you can use it for
- Convert a Kubernetes manifest or Helm values file to JSON to feed into a script or API.
- Turn a JSON config or API response into YAML for a GitHub Actions workflow or docker-compose file.
- Check what a multi-document YAML file actually contains, document by document.
- Sanity-check a hand-edited YAML file by seeing its JSON equivalent.
- Reformat JSON or YAML with a different indent width before pasting it elsewhere.
How it works, step by step
- 1
Pick a direction
YAML → JSON, or JSON → YAML.
- 2
Paste your input
The result updates as you type; invalid input shows a clear, line-referenced error instead of silently producing nothing.
- 3
Choose an indent width
2 or 4 spaces for the output.
- 4
Copy or swap
Copy the result, or swap it into the input to convert back the other way.
Frequently asked questions
What happens to a YAML file with multiple --- documents?
It converts to a JSON array, one entry per document, in order. A single-document YAML file (even one that starts with a leading --- marker) converts to that one JSON value directly, not wrapped in an array.
Does converting a JSON array back to YAML restore the --- documents?
No, deliberately. A JSON array converts to one YAML sequence (a list), not separate documents — most JSON arrays are just lists of values, and splitting every array into --- documents would be surprising far more often than it would be helpful.
Are YAML anchors and aliases (&name / *name) supported?
Yes. An anchor's value is resolved and materialized wherever it's referenced (including with a << merge key), so the JSON output contains the actual repeated data rather than a broken reference.
Does this preserve the order of my keys?
Yes, both directions preserve the original key order rather than sorting alphabetically.
Is my YAML or JSON uploaded anywhere?
No. Parsing and conversion both happen entirely in your browser, which matters here more than for plain text — config files often contain real hostnames, ports, paths or environment values.