datapry

YAML to JSON

Convert YAML to JSON, with anchors, merge keys and multiple documents handled. Runs in your browser, so nothing is uploaded.

Indent

YAML input

JSON output

Waiting for input

About this tool

Convert YAML config files to JSON for APIs and tooling. Anchors and merge keys are expanded, multiple documents become an array, and syntax errors show their exact location. Files built to expand endlessly through aliases are stopped before they can freeze your browser.

How to use it

  1. Paste YAML or import a file.
  2. Choose the output indentation.
  3. Review any warnings, then copy or download the JSON.

Example

Input
base: &base
  retries: 3
prod:
  <<: *base
  host: api.example.com
Output
{
  "base": {
    "retries": 3
  },
  "prod": {
    "retries": 3,
    "host": "api.example.com"
  }
}

Questions

What happens to YAML comments?
JSON has no comments, so they're dropped, and a warning tells you when that happens.
How are multiple documents handled?
A file with several documents separated by --- becomes a JSON array with one item per document.
Is this safe for untrusted YAML?
It only reads data and never runs anything in the file. Alias expansion is capped to stop “billion laughs” files, and strict parsing rejects duplicate keys.