toolo.dev

JSON to YAML Converter

Convert JSON to YAML for Kubernetes, Docker Compose and GitHub Actions. Values like NO, 01234 and on are quoted, so the YAML keeps the meaning of your JSON.

Swap: YAML to JSON
Paste JSON on the left, or load the sample, to see the YAML.

About the JSON to YAML

Convert JSON to YAML for Kubernetes manifests, Docker Compose files, GitHub Actions workflows and other config. Strings that a YAML parser could misread, such as NO, 01234, yes or on, are put in quotes, so the YAML means exactly what your JSON meant.

YAML holds the same data as JSON, but it uses indentation instead of braces, drops most quotes and lets you add # comments. That's why tools you edit by hand, like Kubernetes, Ansible and most CI systems, prefer it. You'll usually reach for this converter when you have JSON from an API, from kubectl get -o json or from a script, and you need it in a file that people will review.

The output is block-style YAML from the js-yaml library, with line wrapping turned off so long strings stay on one line. No server is involved: the conversion happens in the page itself.

  1. Paste JSON into JSON Input, or click Load sample for a small user profile with a nested address, a list and a null.
  2. Read the result under YAML Output, which refreshes after a short pause in your typing. If the JSON has a syntax error, an Invalid JSON box shows the message with its line and column; the JSON Formatter also prints the broken line with a ^ under the problem.
  3. Set Indent to 2 spaces or 4 spaces. There's no tab choice, because the YAML spec forbids tabs for indentation.
  4. Press Sort keys to put object keys in A to Z order at every level. Press it again to go back to the order of your JSON.
  5. Copy the YAML, or download it as converted.yaml. If a note above the YAML says an integer is larger than JavaScript can store exactly, quote that number in your JSON and convert again.
  6. Need the other direction? Swap: YAML to JSON opens the reverse converter.