Skip to content

Convert JSON to YAML

Move a JSON config into YAML with the indentation humans expect in DevOps files.

What this does

YAML is JSON’s indent-sensitive cousin. This landing is JSON→YAML for config, not a YAML linter. Watch out for `on`, `yes`, and country codes that YAML 1.1 treats as booleans — the copy calls that out because a silent type change breaks CI.

Pretty print stays in JSON. This page is specifically the DevOps interchange and the boolean footgun.

People who got a JSON blob from an API and need it in a `.yml` repo file.

YAML exists so humans can edit config. JSON exists so machines can not argue about whitespace. Converting toward YAML is a gift to the next editor.

The Norway problem (`NO`) is not a joke in inventory files. If a value must stay a string, quote it after conversion.

Kubernetes and GitHub Actions are where this conversion actually happens. Docs paste JSON because it is easy to write in a blog. Repos want YAML because diffs and comments are saner. After you convert, run the file through the linter your repo already uses — this page is not kubeval.

Comments in the YAML you hoped for cannot come from JSON. If the JSON was generated from a commented YAML file, those comments are already gone. Add them back by hand on the keys that scare you (`resources`, `on`, `true`).

When to use it

  • Copying a JSON example from docs into a workflow file.
  • Translating a JSON Helm values snippet.
  • You prefer YAML in git diffs.

How to

  1. Paste JSON. Valid JSON only.
  2. Convert to YAML. Copy the output.
  3. Quote risky scalars. Especially in Actions and Ansible.
  4. Commit. Run your usual YAML linter in CI.

Features

  • Bidirectional engine. JSON↔YAML in one tool; this page is JSON→YAML.
  • Local. Cluster configs stay in the tab.
  • Fast iterate. Paste, convert, paste into the PR.

Why it helps

  • Readable git diffs. YAML is kinder than minified JSON in reviews.
  • Matches k8s culture. Manifests are YAML.

Use cases

  • GitHub Actions. Docs often show JSON; repos want YAML.
  • K8s ConfigMaps. JSON application config → YAML wrapper.

Examples

  • Nested settings object. JSON object → indented YAML map. Verify lists stayed lists.

Common mistakes

  • Not quoting `on: push` style keys if they went through a bad converter. Check GitHub Actions files.
  • Expecting comments to survive. JSON has no comments; they will not appear.

Tips

  • After convert, scan for unquoted `yes`, `no`, `on`, `off`.
  • Keep secrets out of both JSON and YAML in tickets.

FAQ

Does this support YAML anchors?
You get a straightforward dump, not an authoring IDE. Add anchors by hand if you need them.
JSON to YAML data loss?
Types should round-trip for ordinary objects and arrays. YAML 1.1 boolean guessing is the famous exception — quote strings that look like booleans.