Data

JSON to YAML

Paste JSON and get human-readable YAML. Helpful when a config comes in JSON but you'd rather edit it as a Kubernetes manifest or GitHub Actions workflow.

Instant🔒In your browserNo signup
Live

When YAML beats JSON

JSON shines for data flowing between machines: strict, fast to parse, natively supported. YAML wins in another scenario: configuration a human will hand-edit. A Kubernetes manifest with a hundred keys and five nesting levels turns illegible in JSON with all those braces and commas. In YAML the same content reads cleanly, with no visual noise.

Typical scenarios

  • Kubernetes. All Kubernetes docs use YAML for manifests. Although kubectl accepts JSON, nobody hand-writes JSON for it.
  • GitHub Actions. Workflows in .github/workflows/*.yml are YAML. If you have JSON for the definition, you must convert.
  • Docker Compose. docker-compose.yml is YAML only.
  • Ansible. Playbooks are YAML by convention.
  • Editing long production configs. When you need to touch a 500-line file, YAML is friendlier.

How each type serializes

  • Plain strings. No quotes if they contain no special characters.
  • Risky strings. Wrapped in double quotes if they contain :, #, start with whitespace, or could be confused with booleans/numbers.
  • Numbers. Bare, no quotes.
  • Booleans. Lowercase true or false.
  • Null. null.
  • Arrays. Hyphen-prefixed list, one item per line.
  • Objects. Key followed by colon, hierarchy denoted by indentation.

Quote rules in YAML

YAML interprets aggressively: many strings turn into booleans or numbers without quotes. These cases are always quoted:

  • Strings matching booleans: "yes", "no", "true", "false", "on", "off".
  • Strings that look like numbers: "123", "3.14", "1e5".
  • Strings starting with a hyphen (could be confused with a list item): "-foo".
  • Strings containing :, #, &, *, !, |, >, %, @, `.
  • Strings with leading or trailing whitespace.

Indentation: source of most bugs

YAML allows only spaces (no tabs) and the count must be consistent within each level. Most common convention: 2 spaces. Mixing 2 and 4 in the same file can produce hierarchies that are interpreted differently than you think. Genfy's converter always emits 2-space indentation, aligned with Kubernetes and GitHub conventions.

Common YAML breakage

Errors you'll often hit when editing the resulting YAML:

  • Forgetting the space after the colon. name:Genfy is invalid; name: Genfy works.
  • Tab indentation. Modern editors warn, but if you pass files between systems, double-check.
  • Ambiguous strings. The famous "NO" Norway problem. If unsure, quote it.

FAQ

Why convert JSON to YAML?

YAML is more readable for humans when configs are hand-edited (Kubernetes, Docker Compose, GitHub Actions).

Does it preserve types?

Yes. Numbers, booleans, null, strings and arrays are preserved.

Does it quote strings?

Only when needed to avoid ambiguity with booleans, numbers or special characters.

Was this generator useful?