Tutorial · JSON → YAML · 3 min read

How to Convert JSON to YAML

Convert JSON from an API or config file into clean YAML for Kubernetes manifests, Helm values or CI pipelines, with strings quoted only where YAML needs it.

Many systems export JSON but expect YAML back: Kubernetes, Helm, GitHub Actions, Ansible. Converting by hand invites indentation mistakes. A converter produces block-style YAML and quotes only the values that would otherwise change type.

What you'll learn

  • Produce readable block-style YAML from any JSON
  • Understand why some strings come out quoted
  • Keep nested arrays and objects correctly indented

Step by step

  1. Paste the JSON

    Open JSON to YAML and paste the document. Output updates as you type.

  2. Review the YAML

    Objects become mappings, arrays become dash lists. Two-space indentation is used throughout.

    {"name":"Ada","roles":["admin","y"]}
    
    →
    
    name: Ada
    roles:
      - admin
      - 'y'
  3. Notice the quoted values

    A bare y would be read back as the boolean true by YAML 1.1 parsers, so it is quoted. The same applies to yes, no, on, off, null and numeric-looking strings.

  4. Copy into your file

    Paste the result under the right key in your manifest or values file, keeping the surrounding indentation consistent.

Open the tool with this example Runs in your browser. Nothing you paste is uploaded.

Common problems

Why is "y" quoted but "admin" is not?

Because y, n, yes, no, on and off are booleans in YAML 1.1. Quoting preserves them as strings.

Multi-line strings look odd

Strings containing newlines are emitted with a block scalar (|) or escapes. Both are valid; the block form is easier to read.

FAQ

Is the output valid for Kubernetes?

Structurally yes. Whether the fields are correct is a separate question; run the result through the Kubernetes YAML Validator.