Developer

YAML ↔ JSON Converter

Convert between YAML and JSON instantly in your browser

YAML ↔ JSON Converter

This tool converts between YAML and JSON formats instantly in your browser. Paste YAML to get pretty-printed JSON, or paste JSON to get clean, readable YAML. No data is sent to any server β€” all conversion happens locally using a built-in parser.

YAML Syntax Quick Reference

  • Mappings (objects): key: value β€” one per line, nested with 2-space indent
  • Sequences (arrays): items prefixed with -
  • Strings: usually unquoted; use "..." or '...' when the value contains special chars
  • Booleans: true / false (also: yes/no, on/off)
  • Null: null or ~
  • Comments: start with #
  • Indentation: must use spaces β€” never tabs

Where YAML Is Used

  • GitHub Actions (.github/workflows/*.yml)
  • Docker Compose (docker-compose.yml)
  • Kubernetes (all manifests: Deployment, Service, ConfigMap…)
  • Ansible (playbooks and inventory)
  • OpenAPI / Swagger API specifications
  • Hugo, Jekyll (front matter and config)
  • Helm charts (values.yaml)

JSON Quirks to Watch When Converting

When converting JSON to YAML, numeric-looking strings and boolean-like strings need to be quoted in YAML to preserve their type. For example, "zip": "12345" in JSON should stay a string in YAML β€” this converter keeps the quotes. Conversely, when converting YAML to JSON, values like yes, no, on, off, and ~ are converted to their JSON boolean/null equivalents.

Frequently Asked Questions

What is YAML?
YAML (YAML Ain't Markup Language) is a human-readable data serialization format designed to be easy for humans to write and read. It uses indentation to express structure, making it popular for configuration files. It is used extensively in Docker Compose files, GitHub Actions workflows, Kubernetes manifests, Ansible playbooks, and many other DevOps and developer tools.
When should I use YAML vs JSON?
Use YAML when humans need to write or read the configuration regularly β€” YAML's clean syntax without brackets and quotes makes it much more readable at scale. Use JSON when the data is consumed primarily by machines, passed in API responses, or when you need strict typing and unambiguous parsing. JSON is a subset of JavaScript and is universally supported; YAML is a superset of JSON.
Is YAML a superset of JSON?
Yes β€” technically, valid JSON is also valid YAML (YAML 1.2 defines JSON as a strict subset). So you can paste JSON directly into a YAML file and it will be parsed correctly. The reverse is not true: YAML-specific syntax like block scalars, anchors, and aliases is not valid JSON.
What are common YAML mistakes?
The most common YAML mistakes are: (1) using tabs for indentation β€” YAML requires spaces only; (2) forgetting to quote strings that look like booleans or numbers, e.g. the string "yes" becomes boolean true unless quoted as "yes"; (3) inconsistent indentation levels; and (4) not quoting strings that contain colons, like a URL used as a value.
What are YAML anchors and aliases?
YAML anchors (&name) let you define a block once and aliases (*name) let you reference it later in the same document to avoid repeating configuration. Example: defaults: &defaults timeout: 30 production: <<: *defaults env: prod. This is a YAML-specific feature with no direct JSON equivalent.