Y/JJSON ↔ YAML
Convert between JSON and YAML formats
JSON vs YAML Complete Comparison Guide
JSON and YAML are two leading formats for structured data. JSON dominates API responses and programmatic configs; YAML's human-friendly syntax has made it the standard for DevOps tooling — Docker Compose, Kubernetes, GitHub Actions, and Ansible all default to YAML. This tool converts between both formats instantly, entirely in your browser.
YAML Syntax Deep Dive
Indentation and Basic Types
YAML uses spaces (never tabs) for hierarchy. Strings need no quotes; numbers, booleans (true/false), and null are auto-detected.
# JSON
{"name": "Alice", "active": true, "score": 9.5}
# YAML (same data)
name: Alice
active: true
score: 9.5Anchors (&) and Aliases (*) — DRY Config
Save a block with an anchor and reuse it with an alias. Invaluable for shared environment variables across Kubernetes deployments or GitHub Actions jobs.
defaults: &defaults image: node:18 restart: always web: <<: *defaults ports: ["3000:3000"] api: <<: *defaults ports: ["4000:4000"]
Multiline Strings (| vs >)
| (literal block) preserves newlines exactly. > (folded block) joins lines with spaces. Use them to embed shell scripts or long SQL inside config files.
When to Choose YAML
- Kubernetes / Helm: Official manifest format is YAML
- Docker Compose:
docker-compose.ymlstandard - GitHub Actions / GitLab CI: Workflow files are YAML
- Ansible: Entire playbook ecosystem is YAML-based
- API communication / webhooks: JSON is better (universal parser support)
Practical Example: Docker Compose Conversion
Paste a JSON service definition, click JSON → YAML, and you get a docker-compose.yml-ready output in one click.