YAML, JSON and XML converter

Convert between YAML, JSON and XML as you type. Anchors and merge keys are resolved, several YAML documents become a list, and every error is shown with its line and column.

Free and private. Everything runs in your browser, nothing is uploaded.

How it works

  1. Paste your dataPaste YAML, JSON or XML, or open a file. Sample shows an example for the chosen direction.
  2. Choose the directionPick YAML to JSON, JSON to YAML, XML to JSON or JSON to XML. The result updates as you type.
  3. Copy or downloadCopy the result, download it as a file, or press Swap to convert it back and compare.

Three formats for the same data

JSON is what APIs send and JavaScript reads. YAML is what people write by hand in configuration files for Docker Compose, Kubernetes, GitHub Actions or Ansible. XML is still everywhere in feeds, invoices, Office files and older web services. They all describe the same kind of data: objects, lists, text, numbers and true or false, so they can be converted into each other.

Some details do not survive every trip. Comments in YAML and XML are dropped, because JSON has no comments. XML has no lists or numbers of its own, so repeated elements become arrays and numbers are recognized only if you turn that on. Each direction below explains what happens to such cases.

A real YAML parser, not a shortcut

YAML has many rules that simple converters get wrong: block text with | and >, quoted and unquoted text, anchors (&name) and aliases (*name), merge keys (<<) and several documents in one file, each starting with a line of three hyphens. This tool uses a complete YAML parser that follows the YAML 1.2 specification, and it limits alias expansion so that a hostile file cannot freeze your browser.

Frequently asked questions

Is my data uploaded?

No. The conversion runs in your browser. Configuration files with passwords or keys never leave your device.

Why is yes still text in my JSON?

In YAML 1.2, the current version, only true and false are booleans. Older YAML 1.1 tools also read yes, no, on and off as booleans. Turn on the YAML 1.1 option if your file was written for such a tool.

What happens with several YAML documents?

If the input has more than one document, each starting with a line of three hyphens, the JSON result is a list with one item per document.

How are XML attributes shown in JSON?

Attributes get an @ in front of their name, for example @id. If an element has attributes and text, the text goes into #text. You can choose another prefix for attributes.

Does it work offline?

Yes. After you open the page once, it keeps working without an internet connection.