YAML to JSON

Convert YAML mappings, sequences and scalars to JSON. Comments are stripped automatically.

Input YAML
1
JSON Output
Output appears here…
2sp · 14px · UTF-8

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:

yaml
user:
  name: Ravi Kumar
  age: 28
  active: true
  address:
    city: Surat
    country: IN
  tags:
    - developer
    - typescript

Output JSON:

json
{
  "user": {
    "name": "Ravi Kumar",
    "age": 28,
    "active": true,
    "address": { "city": "Surat", "country": "IN" },
    "tags": ["developer", "typescript"]
  }
}

Scalar Type Mapping

YAML valueJSON typeNotes
42, 3.14numberIntegers and floats are preserved
true, false, yes, no, on, offbooleanAll YAML boolean aliases are supported
null, ~, (empty)nullNull and tilde both become JSON null
"quoted string"stringSingle and double quoted strings are unquoted
plain stringstringUnquoted strings that don't match other types

Common Use Cases

  • Kubernetes / HelmConvert k8s manifest YAML to JSON for API calls or audit tools.
  • CI/CD configTransform GitHub Actions or GitLab CI YAML to JSON for programmatic analysis.
  • OpenAPI / SwaggerMany tools accept OpenAPI specs as JSON — convert from YAML in one click.
  • Docker ComposeInspect or diff docker-compose.yml contents as structured JSON.

Frequently Asked Questions

No. JSON has no comment syntax, so all YAML comments (# ...) are stripped during conversion.

Only the first document is converted. Multi-document YAML files are not fully supported — split them manually before converting.

Basic anchors and aliases are not supported by the parser. Resolve them manually before converting.

Yes — use the JSON to YAML tool which produces clean, indented YAML from any JSON object.

Related Tools