- All tools
- YAML ⇄ JSON
How do I convert YAML to JSON — or JSON to YAML?
Paste YAML — a Kubernetes manifest, a GitHub Actions workflow, a Docker Compose or config file — and get JSON; or paste JSON and get clean YAML. When the YAML has a mistake, the page shows the exact line and column with the surrounding lines. Several documents separated by --- can become a JSON array.
- Choose YAML → JSON or JSON → YAML.
- Paste your data.
- Copy or download the result — or fix the error shown.
What this page can do
- YAML 1.2 to JSON and JSON to YAML
- Exact line and column for syntax errors, with context
- Multi-document YAML (---) to a JSON array
- Sort keys and choose 2- or 4-space indentation
- Anchors and aliases are expanded in JSON
- No line wrapping of long strings in YAML output
When to use this page
- Checking why a Kubernetes, Compose or CI file does not parse.
- Feeding a YAML config to a tool or API that wants JSON.
- Turning an API’s JSON response into a readable YAML config.
When to use something else
- You need to keep YAML comments — JSON has no comments, so they are dropped.
- You need to validate against a schema such as a Kubernetes or OpenAPI schema — use the matching linter.
- The file uses custom YAML tags such as !Ref — they are not supported here.
How it compares with other options
Command-line tools such as yq and editors with YAML extensions convert and validate too, and they keep comments when editing YAML in place. This page uses js-yaml, a widely used parser, in your browser, so private configuration and secrets in your files are not uploaded anywhere.
Where your data goes
Nowhere. Everything is computed by your own browser. Nothing you paste is sent to a server, logged or stored — close the tab and it is gone. You can check it yourself: open your browser’s network panel — the page still loads its own code and any ads, but no request carries what you typed.
Questions about this tool
Why are my comments gone?
JSON cannot store comments, so they are dropped when converting YAML to JSON, and a round trip back to YAML cannot bring them back. Keep the original YAML file if you need its comments.
Why did “yes” or “on” stay a string?
The page uses YAML 1.2 rules, where only true and false are booleans. Older YAML 1.1 tools treat yes, no, on and off as booleans too, which is a common source of bugs; quote such values if a tool needs a specific type.
What happens with several documents separated by ---?
With the option on, each document becomes one item of a JSON array. With it off, only the first document is converted, and the page tells you how many were found.
What are anchors and aliases?
YAML can define a value once with &name and reuse it with *name. When converting to JSON they are expanded into full copies. When converting to YAML, “Never use YAML anchors” keeps the output plain, even if parts repeat.