Tools

JSON → YAML

Convert JSON data to YAML format.

JSON
Ln:1 Col:1
YAML

About JSON to YAML Conversion

YAML (YAML Ain't Markup Language) has become the default configuration format for modern DevOps and cloud-native infrastructure. Kubernetes manifests, Docker Compose files, GitHub Actions workflows, Ansible playbooks, and CI/CD pipelines all use YAML. Converting JSON to YAML is one of the most common tasks in DevOps workflows, especially when transforming API responses into configuration files or migrating from JSON-based configs to YAML.

YAML vs JSON Quick Reference

YAML uses indentation instead of braces and brackets, making it more readable for configuration files. YAML supports comments (lines starting with #), multi-line strings (using | for literal blocks or > for folded blocks), and anchors/aliases for reusing values. Every valid JSON document is also valid YAML, but YAML offers additional features that JSON lacks. YAML uses 2-space indentation by convention, and tabs are not allowed.

Key differences to remember: YAML strings generally do not need quotes unless they contain special characters like colons, brackets, or hash symbols. Boolean values in YAML (true/false, yes/no, on/off) can cause unexpected type coercion — the "Norway problem" (where NO is interpreted as false) is a well-known YAML pitfall. Numbers that look like octal (0755) or floats (1.0) may also be auto-converted. When in doubt, quote string values to prevent unintended type conversion.

Frequently Asked Questions

Why do I get indentation errors in YAML?
YAML does not allow tabs — use spaces (2-space indent recommended). Check your editor's tab-to-space setting.
What is the "Norway problem" in YAML?
In YAML 1.1, NO is interpreted as boolean false. To keep country code NO (Norway) as a string, quote it: "NO". YAML 1.2 only treats true/false as booleans.
Are JSON comments preserved after YAML conversion?
Standard JSON does not support comments. Comments in JSON5/JSONC are stripped during parsing. YAML supports # comments, so add any needed comments after conversion.