YAML → JSON
YAML Input
Loading editor…
JSON Output
Loading editor…

YAML to JSON Converter

Paste any YAML document and get clean, formatted JSON instantly. Supports nested objects, arrays, multi-line strings, and YAML anchors. No login, no data upload.

Real-time
JSON output updates as you type or paste.
Full YAML spec
Anchors, aliases, multi-line strings, and all scalar types supported.
Download
Save the result as a .json file instantly.
Client-side
No data is uploaded. Everything runs in your browser.

How YAML to JSON Conversion Works

YAML and JSON share the same data model — objects, arrays, strings, numbers, booleans, nulls — so conversion is lossless in most cases. YAML mappings become JSON objects, sequences become arrays, and scalars become their typed equivalents.

server:
  host: localhost
  port: 8080
features:
  - auth
  - logging
{
  "server": { "host": "localhost", "port": 8080 },
  "features": ["auth", "logging"]
}

Anchors and aliases are resolved before output, so the JSON contains fully expanded values with no YAML-specific references.

YAML Type Coercion — What Changes in JSON

YAML has more implicit types than JSON. Most map cleanly, but a few are worth knowing:

YAML valueJSON outputNotes
4242Integer
3.143.14Float
true / yes / ontrueBoolean — YAML accepts all three
false / no / offfalseBoolean
null / ~ / (empty)nullNull
"2024-01-01""2024-01-01"Dates stay as strings in JSON
!!str 42"42"Explicit type tag forces string

The common gotcha: bare yes/no/on/off are booleans in YAML 1.1. If you're using them as string values — a port name, a feature flag key — quote them in the source YAML.

Real-World Use Cases

K8s manifests and Helm values files are YAML. Converting to JSON lets you query them with JSONPath, validate against a JSON Schema, or pipe values into scripts that expect JSON.

GitHub Actions workflow files are YAML. JSON is easier to parse programmatically when inspecting complex if conditions or matrix configurations.

docker-compose.yml is YAML — converting to JSON makes it straightforward to diff two compose files in the JSON Diff tool. OpenAPI specs are commonly written in YAML; most code generators accept both, but some JSON-only tooling requires conversion first.

Ansible playbooks, ESLint, and Prettier configs all have YAML and JSON variants. Converting is faster than manually reformatting.

YAML vs JSON — When to Use Each

FeatureYAMLJSON
CommentsYes — # commentNo
Multiline stringsYes — block scalars `and>`
Anchors / aliasesYesNo
Human writabilityHighMedium
Tooling supportConfig files, CI/CDAPIs, databases, code
StrictnessLoose (implicit types)Strict

YAML is for files humans write and read directly — configs, CI pipelines, IaC. JSON is for data machines produce and consume — APIs, SDKs, storage. The two overlap constantly, which is why conversion in either direction is a routine task.

Frequently Asked Questions

Are YAML anchors and aliases supported?

Yes. Anchors (&name) and aliases (*name) are resolved during parsing, so the output JSON contains the fully expanded values with no anchor references remaining.

What happens to YAML comments?

YAML comments (lines starting with #) are ignored — they have no JSON equivalent and are not included in the output.

Can this convert Kubernetes or Docker Compose YAML?

Yes. Any valid YAML can be converted, including Kubernetes manifests, Helm values, and Docker Compose files. Multi-document YAML (files with --- separators between documents) will only convert the first document.

Why does 'yes' or 'no' become true/false in my output?

In YAML 1.1 (which many tools use), yes/no/on/off are boolean literals, not strings. If you need them as strings, quote them in your YAML source: '"yes"' or '"no"'.

Are multiline strings preserved?

Yes. YAML block scalars (| for literal, > for folded) are parsed correctly and output as a single JSON string. Literal block scalars preserve newlines; folded scalars collapse newlines into spaces.

What happens if my YAML has a syntax error?

An error message is shown in the output panel with the line number and description from the js-yaml parser. Common issues are incorrect indentation, missing colons, and unquoted special characters.

Is my YAML data uploaded anywhere?

No. All conversion happens locally in your browser using js-yaml. Your data never leaves your device — safe to use with Kubernetes secrets, CI tokens, or any sensitive configuration.