YAML to JSON Converter — Convert YAML Config Files to JSON Online
FreeConvert YAML to JSON online instantly. Handles anchors, aliases, and multi-document YAML. Free, browser-based, no upload required.
What's next
Settings guide
Multi-document YAML (`---` separator):
- ·Split into array — Multiple YAML documents separated by
---are converted to a JSON array of objects. - ·First document only — Ignores all but the first YAML document. Use when only the primary document is relevant.
Null handling:
- ·JSON null — YAML
null,~, and empty values become JSONnull. - ·Empty string — YAML null/empty values become
"". Some APIs prefer this.
Note: YAML comments (# ...) have no JSON equivalent and are discarded during conversion. YAML anchors (&anchor) and aliases (*anchor) are resolved to their full values in the JSON output.
Format comparison
YAML vs JSON as a config format: YAML supports comments, multi-line strings, anchors for reuse, and a cleaner syntax for nested data. JSON is stricter, more portable, and natively parsed by every language without an external library. YAML is better for human-authored configs; JSON is better for machine-to-machine data exchange.
YAML to JSON vs yq / jq: The yq command-line tool converts YAML to JSON: yq eval -o=json file.yaml. jq processes JSON: cat file.yaml | yq eval -o=json | jq '.field'. The online converter is faster for one-off conversions and when you're not in a terminal context.
How it works
Parse YAML
The YAML is parsed according to the YAML 1.2 specification. Anchors and aliases are resolved — every reference is replaced with the full value it points to before conversion begins.
Map types
YAML types are mapped to JSON equivalents: YAML booleans (yes/no, on/off, true/false) → JSON true/false. YAML null and ~ → JSON null. YAML integers and floats → JSON numbers. Timestamps → JSON strings.
Handle multi-document
If the input contains multiple YAML documents separated by ---, each is converted separately according to the selected output mode (array of objects, or first document only).
Serialise to JSON
The parsed YAML structure is serialised as formatted JSON with 2-space indentation. Comments are discarded — they have no JSON equivalent.
About this format
YAML is the human-readable config format for Kubernetes manifests, Docker Compose files, GitHub Actions workflows, Ansible playbooks, and countless other DevOps tools. JSON is what REST APIs, JavaScript applications, and most language runtimes consume natively.
Converting between them is a daily task when you need to pass a YAML config's values to an API, seed a database from config data, or debug a Kubernetes object by inspecting it as JSON. Paste YAML and the equivalent JSON is produced immediately — including anchors and aliases resolved, and multi-document YAML split into separate JSON outputs.