YAML to JSON
Convert YAML mappings, sequences and scalars to JSON. Comments are stripped automatically.
What is YAML?
YAML (YAML Ain't Markup Language) is a human-readable data serialization format designed to be clean and minimal. Instead of brackets and quotes, YAML uses indentation to show structure, making it popular for configuration files. It is used in Docker Compose, Kubernetes manifests, GitHub Actions, GitLab CI, Ansible playbooks, and Helm charts.
YAML and JSON represent the same data model — they can express the same structures. YAML is easier for humans to write and read (no brackets, no quotes required), while JSON is easier for machines to parse and is the standard for APIs. Converting YAML to JSON is a common need when you want to pass configuration data to a REST API, store it in a JSON database, or use tooling that only accepts JSON.
YAML to JSON Conversion Example
Input YAML:
user:
name: Ravi Kumar
age: 28
active: true
address:
city: Surat
country: IN
tags:
- developer
- typescriptOutput JSON:
{
"user": {
"name": "Ravi Kumar",
"age": 28,
"active": true,
"address": { "city": "Surat", "country": "IN" },
"tags": ["developer", "typescript"]
}
}Scalar Type Mapping
| YAML value | JSON type | Notes |
|---|---|---|
| 42, 3.14 | number | Integers and floats are preserved |
| true, false, yes, no, on, off | boolean | All YAML boolean aliases are supported |
| null, ~, (empty) | null | Null and tilde both become JSON null |
| "quoted string" | string | Single and double quoted strings are unquoted |
| plain string | string | Unquoted strings that don't match other types |
Common Use Cases
- ▸Kubernetes / Helm — Convert k8s manifest YAML to JSON for API calls or audit tools.
- ▸CI/CD config — Transform GitHub Actions or GitLab CI YAML to JSON for programmatic analysis.
- ▸OpenAPI / Swagger — Many tools accept OpenAPI specs as JSON — convert from YAML in one click.
- ▸Docker Compose — Inspect or diff docker-compose.yml contents as structured JSON.