FormatDrop
How-To Guide

How to Convert YAML to JSON

YAML is the human-readable configuration format used in Kubernetes, Docker Compose, GitHub Actions, and Ansible. JSON is the machine-readable format used by virtually every API, config parser, and tool. Converting YAML to JSON makes configuration files importable into tools that don't speak YAML, and is a useful debugging step to flatten YAML anchors and aliases.

Step-by-step instructions

  1. 1

    Upload your YAML file

    Provide your .yaml or .yml file. Configuration files, Kubernetes manifests, GitHub Actions workflows, and Ansible playbooks all work. Multi-document YAML (using --- separators) may produce an array of JSON objects.

    Go to converter
  2. 2

    Select JSON as output format

    Choose JSON. The converter parses YAML including anchors and aliases (&, *) and resolves them to their expanded form in the JSON output. Comments (# ...) are stripped — JSON has no comment syntax.

  3. 3

    Download and use the JSON

    The output JSON can be imported into any tool that accepts JSON configuration, validated with a JSON linter, or imported into a database. It's also useful as an intermediate step when migrating configuration formats.

Why convert YAML to JSON?

YAML is written by humans configuring infrastructure; JSON is consumed by machines processing data. Converting between them is a routine operation in DevOps and API workflows — both formats describe the same structure in different syntax.

Your files never leave your device

FormatDrop runs the conversion engine entirely inside your browser using WebAssembly. No file upload. No server. Nothing stored. You can verify this by opening DevTools → Network tab and watching: zero upload requests.

Frequently asked questions

How do I convert YAML to JSON on the command line?
Using Python: `python3 -c "import yaml,json,sys; print(json.dumps(yaml.safe_load(sys.stdin), indent=2))" < input.yaml > output.json`. Using yq: `yq -o=json input.yaml > output.json`. Using Node.js: `node -e "const y=require('js-yaml'),fs=require('fs'); console.log(JSON.stringify(y.load(fs.readFileSync('input.yaml','utf8')),null,2))"`.
Are YAML comments preserved in the JSON output?
No — JSON has no comment syntax. All YAML comments (# ...) are stripped during conversion. If you need to keep annotations, add them as JSON keys (e.g., '_comment': 'description here') before converting.
How do YAML anchors and aliases convert to JSON?
YAML anchors (&name) and aliases (*name) are resolved to their full expanded values in the JSON output. A YAML anchor used three times becomes three identical JSON objects. This can cause JSON output to be much larger than the YAML source.
Convert YAML to JSON Now — Free

No account. No upload. Works in any browser.