JSON to YAML Converter

Convert JSON to YAML that is ready to paste into a Kubernetes manifest, GitHub Actions workflow or Docker Compose file.

JSON
YAML
Runs locally in your browser

About the JSON to YAML Converter

YAML is a superset of JSON, so every JSON document has an exact YAML equivalent. The interesting part is producing YAML that a person would write: block style for objects and arrays, unquoted strings where the YAML grammar allows it, and quotes only where a value would otherwise be read as a number, boolean or null. This converter uses the js-yaml library in its strict YAML 1.2 mode to make those decisions, so "yes", "1.0" and "null" stay strings after a round trip.

You can choose two or four space indentation and whether strings that need quoting get single or double quotes. Long strings are never folded, so each value stays on one line; that keeps diffs simple in version control. Key order is preserved, and duplicate keys are impossible because the input is parsed as JSON first.

Common uses are turning a JSON API example into a config file, converting Terraform or CloudFormation output for a Helm chart, or simply reading a large JSON blob in a less bracketed form. The reverse converter handles anchors, multi-document files and the other YAML features that JSON lacks.

How to use

  1. Paste JSON on the left or upload a file.
  2. Pick the indent width used by the project you are pasting into (Kubernetes and most linters expect 2).
  3. Copy the YAML. Swap sends it to YAML to JSON to confirm it round-trips.

Common questions

Will string values like "true" or "123" stay strings in the YAML?
Yes. The converter quotes any string that YAML would otherwise interpret as a boolean, number or null, so the types survive a round trip.
Does it support JSON with very long strings?
Yes. Long strings are kept on one line rather than folded, which is safest for values like keys and URLs.
Which YAML version is produced?
YAML 1.2 core schema. It is also valid YAML 1.1 for the constructs used, so older parsers such as PyYAML read it correctly.
Can I convert a JSON array to a YAML list?
Yes. A top-level array becomes a block sequence, each item starting with a dash.