What YAML to JSON conversion is
YAML is the format most teams reach for when a config file has to be edited by hand. Kubernetes manifests, CI pipelines, Docker Compose, Ansible playbooks, and application settings all lean on its indentation, comments, and lack of braces. JSON is the format machines prefer: it is stricter, has no comments, and is understood by virtually every language, HTTP API, and query tool. Converting between them lets you keep authoring in YAML while handing a JSON payload to whatever needs it.
Structurally, the mapping is direct. A YAML block mapping — key: value lines at the same indentation — becomes a JSON object. A YAML sequence of - item lines becomes a JSON array. Nesting is expressed by indentation in YAML and by braces and brackets in JSON, so the tree shape is preserved exactly.
The interesting work happens at the leaves. A bare scalar like 8080 has no declared type in the text, so the converter has to decide whether it is a number, a boolean, null, or a string. That coercion step is where most surprises live, and it is spelled out in the next section.