YAML to JSON Converter

YAML

JSON


      
Your result shows up here.

About the YAML to JSON Converter

YAML is common in config files such as Docker Compose, Kubernetes manifests and CI pipelines, while most APIs and tools expect JSON. This tool converts between the two in both directions, so you can check what a YAML file really contains or write a config from a JSON payload.

It reads multi-document YAML, expands anchors, aliases and merge keys, and lets you pick 2 spaces, 4 spaces or tab indentation and sort the keys. If the input is not valid, you see the line and column of the first problem with a plain message. Everything runs in your browser using the open source js-yaml library.

How to convert YAML to JSON

  1. Paste your YAML or upload a .yaml or .yml file.
  2. Fix any error shown with its line and column.
  3. Pick the indentation and turn on Sort keys if you want.
  4. Copy the JSON or download it as a .json file. Press Swap to go back the other way.

Frequently asked questions

How do I convert YAML to JSON?

Paste or upload your YAML with YAML to JSON selected. The JSON appears as you type. Choose the indentation, then copy it or download it as a .json file.

How do I convert JSON to YAML?

Choose JSON to YAML and paste your JSON. You can also press Swap on a finished conversion to turn the result back into the other format.

What happens to a file with several YAML documents?

Documents separated by --- are read one by one. When there is more than one, the JSON result is an array with one item per document. Going the other way, turn on Split array into documents to write each item of a top-level array as its own document.

Are anchors, aliases and merge keys supported?

Yes. An alias such as *base is replaced by a copy of the value it points to, and a merge key (<<: *base) is expanded, so the JSON contains the full data.

How are errors reported?

The tool shows the line and column of the first problem with a plain message, and a Go to error button that selects it in the input.

Is my data uploaded anywhere?

No. The conversion runs in your browser and nothing leaves your device.

Is anything lost in the conversion?

Comments are dropped because JSON has no comments, and anchors turn into plain copies. Dates such as 2026-11-08 become ISO strings. Integers larger than 9007199254740991 can lose precision, as they do in any JavaScript tool.