elefcode

YAML ↔ JSON Converter

Convert YAML to JSON and back — anchors, merge keys and multi-document files included.

Advertisement

Guide

About the YAML ↔ JSON Converter

YAML and JSON are two ways of writing the same kind of structured data. JSON is compact and used everywhere as an API and data-interchange format. YAML is designed to be human-friendly — it uses indentation instead of braces, allows comments, and is the format of choice for configuration files (Docker Compose, Kubernetes, CI pipelines, and more). This tool converts between them in either direction.

Paste YAML to get clean JSON, or paste JSON to get readable YAML. If your input has a syntax problem, you'll get a clear error pointing at what went wrong. Everything runs locally in your browser.

When to use YAML vs. JSON

Reach for JSON when a program is producing or consuming the data — APIs, storage, and message payloads. Reach for YAMLwhen a human is meant to read and edit it, like app configuration, because it's less noisy and supports comments. Converting between them lets you author config in friendly YAML and hand a service the JSON it expects, or vice versa.

Watch out for YAML gotchas

YAML's flexibility has sharp edges. Indentation must use spaces, not tabs. Unquoted values like yes, no, and on can be interpreted as booleans, and a leading zero can turn a value into a number. When precision matters, quote your strings. Converting to JSON is a great way to see exactly how YAML parsed your values.

How to use it

  1. 1Choose the direction: YAML → JSON or JSON → YAML.
  2. 2Paste your YAML or JSON into the input pane.
  3. 3Read the converted result, or fix any syntax error it reports.
  4. 4Copy the output into your config file or API request.

Frequently asked questions

Is YAML a superset of JSON?

Yes. Any valid JSON is also valid YAML, so YAML parsers can read JSON directly. This tool goes further by converting YAML into clean JSON and formatting JSON as readable YAML.

Why would I convert YAML to JSON?

To feed a system that only accepts JSON, to debug how YAML parsed ambiguous values, or to embed config in a JSON-based tool. The reverse is handy for making dense JSON easier to read and edit.

Why did my YAML value become true or a number?

YAML auto-detects types, so true/false, null and numeric-looking values are converted — quote a value to keep it as a string. Under the older YAML 1.1 rules, used by PyYAML and many older tools, yes/no/on/off are booleans too, so a country code like NO becomes false. This tool reads YAML 1.2 by default and warns about such values; tick YAML 1.1 to see how older tools read the file.

Does it handle files with several documents?

Yes. Documents separated by --- (as in Kubernetes manifests) become a JSON array, and with “Array → separate documents” a JSON array turns back into a multi-document YAML file.

Are anchors and merge keys supported?

Yes. &anchors, *aliases and <<: merge keys — common in docker-compose and CI files — are resolved, so the JSON shows the final values.

Does it report errors?

Yes. Malformed YAML or JSON shows the parser message with the line, and a button that jumps to it. Duplicate keys are reported as errors rather than silently overwritten.

Is my data uploaded?

No. Conversion runs entirely in your browser, so configuration and secrets stay on your device.

Learn more

Related tools