YAML to JSON Converter & JSON to YAML Online

YAML to JSON Converter & JSON to YAML Online

Paste YAML from docker-compose, Kubernetes or GitHub Actions and get JSON instantly, with anchors expanded and multi-document files (---) as an array.

Updated November 2026

Reviewed by Rafael Duarte

Shift + Enter to Copy
Input YAML Valid YAML
Output JSON JSON
33 lines · 534 chars

How to use the YAML to JSON converter

Pick a direction, paste, get validated output instantly

1. Pick a direction

Toggle "YAML → JSON" or "JSON → YAML" at the top of the tool.

2. Paste your input

Drop it in the left panel, or click "Paste" to grab it straight from your clipboard.

3. Copy or download the result

The output updates as you type. A "Valid YAML" or "Valid JSON" badge confirms the input parsed; then click Copy, or Download to save it as output.json or output.yaml.

What this YAML to JSON converter does

Accurate conversion in both directions

Real-time validation

A green "Valid YAML" or "Valid JSON" badge confirms your input parsed. If it doesn't, you get "Invalid" and the parser's message with the line and column.

Resolves anchors, aliases and merge keys

YAML's & anchors, * aliases and <<: *base merge keys (common in docker-compose x- blocks) are fully expanded in the resulting JSON.

Multi-document files

Several documents separated by ---, like a Kubernetes manifest or helm template output, become one JSON array with one item per document.

Lossless JSON to YAML

Since YAML 1.2 is a superset of JSON, this direction always converts cleanly, preserving every type and nesting level.

Runs entirely in your browser

No sensitive config — API keys, secrets, connection strings — ever leaves your device.

Examples

What changes and what doesn't

Situation
Result
# comment in the YAML
Stripped out — JSON has no comment syntax
&ref anchor and *ref alias
Fully expanded in the output JSON
a: 1 --- b: 2
[{"a": 1}, {"b": 2}]
python-version: 3.10
3.1 (a number; quote it as "3.10" to keep the string)
on: push
"on": "push" (YAML 1.2: on, yes and no stay strings)
JSON → YAML
Lossless (except integers above 2^53) — every valid JSON document is already valid YAML

When you'll reach for this tool

The scenarios that come up most often

Kubernetes and Helm

Feed YAML manifests into CI/CD pipelines that only accept JSON, or convert Helm values back for readability.

OpenAPI and Swagger specs

Convert a YAML API spec to JSON when your toolchain requires it, or flip it back for human review.

Docker Compose and Ansible

Move service configs or playbooks between formats depending on which tool downstream is consuming them. New to Compose? Read Docker Compose for development.

GitHub Actions workflows

Debug or adapt YAML workflow files by converting them to JSON for schema validation.

Common mistakes

Expecting comments to survive the conversion

JSON has no comment syntax — keep the original YAML alongside the generated JSON if you need the documentation.

Unquoted values change type

YAML guesses types for unquoted scalars, and the JSON shows the result: 3.10 becomes the number 3.1 (the classic GitHub Actions python-version trap), 0777 becomes 777, and 2024-01-15 becomes the string "2024-01-15T00:00:00.000Z". Quote the value in the YAML ("3.10") to keep it exactly as written.

Not realizing aliases get expanded

The resulting JSON contains no YAML-specific constructs — every anchor and alias is fully resolved into its actual value.

Inconsistent indentation in the source YAML

YAML is indentation-sensitive — mixing tabs and spaces is the single most common cause of parsing errors.

Why use this converter

It resolves the parts that trip up simpler converters (anchors, aliases, merge keys, multi-document files) and tells you upfront what gets lost: comments are dropped, and unquoted values like 3.10 or dates change type.

Everything runs client-side in your browser, so it's safe to convert sensitive config files, templates with embedded API keys, and infrastructure definitions without them ever touching a server.

YAML vs. JSON

Same data, different audiences

YAML
JSON
Syntax
indentation, minimal punctuation
curly braces and brackets
Supports comments
yes (#)
no
Used by
Kubernetes, Docker Compose, Ansible
REST APIs, data interchange
Every valid JSON file is...
valid YAML (YAML 1.2 is a superset)
—

Frequently asked questions

YAML uses indentation and minimal punctuation, which makes it easier for humans to hand-edit — that's why Kubernetes, Docker Compose, and Ansible all use it for config. JSON uses braces and brackets with stricter syntax, and it's the standard for REST APIs and data interchange. Because YAML 1.2 is a superset of JSON, any JSON document is already valid YAML.

References

Related Tools