Convert JSON to YAML in your browser
YAML is the config format behind CI pipelines, Kubernetes manifests and Docker Compose, while data and API responses arrive as JSON. This converter turns any valid JSON into clean, readable YAML with consistent two-space indentation, ready to paste into a config file.
How it works
The converter walks the parsed JSON and emits indented YAML:
- Objects become
key: valuelines. - Arrays become
- itementries, nested objects indenting two spaces deeper. - Scalars — strings, numbers, booleans, null — are written directly.
- Safe quoting: a string that could be misread as a number, boolean or YAML
keyword (such as
"true","123"or a value containing a colon) is wrapped in quotes so the YAML round-trips back to the same JSON.
Example
This JSON:
{ "name": "demo", "enabled": true, "ports": [80, 443], "version": "1.0" }
becomes:
name: demo
enabled: true
ports:
- 80
- 443
version: "1.0"
The ports array became a YAML list, and the string "1.0" was quoted so it is
not re-read as a number. The conversion happens entirely in your browser — your
config and data are never uploaded or stored.
When you would need this conversion
GitHub Actions and CI pipelines. Pipeline configuration is written in YAML, but tooling that generates step definitions or matrix configurations often outputs JSON. Converting to YAML lets you paste generated config directly into a workflow file.
Kubernetes manifests. The kubectl apply command accepts both JSON and YAML, but YAML is overwhelmingly the community convention for manifests. If your API or template system produces JSON, this converter bridges the gap.
Docker Compose. docker-compose.yml is YAML-only. If you configure services programmatically and export JSON, you need to convert before Docker Compose will read it.
Ansible and Helm. Both use YAML for their configuration and values files. JSON data from infrastructure APIs converts cleanly to YAML for use in playbooks or values overrides.
Human-readable config files. YAML allows comments (lines starting with #) while JSON does not. Converting a JSON config to YAML is often the first step before adding explanatory comments to the file for the team.
How YAML quoting decisions are made
The converter applies safe quoting to scalar values that YAML would otherwise misinterpret:
- Strings that look like booleans —
"true","false","yes","no","on","off"— are quoted so they remain strings rather than being parsed as YAML boolean values. - Strings that look like numbers —
"123","1.0","0xFF"— are quoted so they remain strings rather than being silently cast to a numeric type. - Strings containing a colon followed by a space —
"host: value"— are quoted because YAML parses that pattern as a key-value pair. - Empty strings are written as
""to remain unambiguous.
Numbers, booleans, and null values in the original JSON are written unquoted because YAML’s type system matches the JSON type system for those primitives.
YAML limitations compared to JSON
YAML is more expressive than JSON but also more error-prone to write by hand. Indentation is semantic in YAML — a single extra space can change the structure. When editing converted YAML, use a YAML linter or validator before relying on the result in production. The converted output uses consistent two-space indentation throughout to minimise ambiguity.