How it works
The YAML to JSON Converter parses a YAML document and transforms it into equivalent JSON — preserving data types, nested structures, arrays, and multi-line string values.
YAML is the standard configuration format for Kubernetes manifests, Docker Compose files, GitHub Actions workflows, Ansible playbooks, and many CI/CD pipelines. JSON is the lingua franca of APIs and JavaScript applications. Converting between them is a constant need when working across these domains.
How to use it: paste your YAML. The converter parses it (including multi-document YAML with --- separators), correctly handles YAML's data types (strings, numbers, booleans, null, dates), and produces pretty-printed JSON. Multi-document YAML produces a JSON array of documents.
YAML features handled: block and flow scalars, block and flow sequences (arrays), block and flow mappings (objects), anchors and aliases (* and &), merge keys (<<:), multi-line strings (| literal block, > folded block), explicit type tags (!!int, !!str, !!bool), null values (~ and null), and boolean variants (yes/no, on/off, true/false — all mapped to JSON true/false).
Edge case note: YAML's boolean handling is a common source of bugs. The strings "yes", "no", "on", "off" are valid YAML booleans. This converter follows YAML 1.1 rules (matching most real-world parsers) which treat these as booleans, not strings.
Frequently Asked Questions
- Yes. Anchors (&name) and aliases (*name) are resolved — the aliased content is inlined in the JSON output. YAML merge keys (<<:) are also resolved, merging the referenced mapping into the current object.
- YAML 1.1 treats strings like 2024-01-15 as date values. They are converted to ISO 8601 date strings in JSON. If you need to prevent date conversion, quote the value in YAML: '2024-01-15'.
- YAML 1.1 treats yes, no, on, off, true, false (and their uppercase variants) as booleans. They become JSON true or false. To keep them as strings, quote them in YAML: 'yes'.
- Yes. YAML files with multiple documents separated by --- are converted to a JSON array, where each element is the parsed document.