YAML ⇄ JSON Converter

Convert YAML to JSON and JSON to YAML instantly with full support for anchors, aliases, and multi-document files. 100% client-side.

449 chars
Converting...
🔒 100% private: All conversion happens in your browser using the js-yaml library. Your data never leaves your device.

About YAML to JSON Converter

YAML (YAML Ain't Markup Language) and JSON (JavaScript Object Notation) are the two dominant configuration formats in modern software. Kubernetes uses YAML for manifests, Docker Compose uses YAML, GitHub Actions uses YAML, and many CI/CD pipelines prefer YAML for its readability. Meanwhile, JSON is the native format for APIs, JavaScript, and most programming languages. Converting between them is a routine task — deploying a Kubernetes manifest via an API that wants JSON, editing a JSON config in a human-friendly YAML editor, or validating a config file. This tool converts both ways in your browser with full YAML 1.2 support including anchors, aliases, multi-document streams, and all standard data types.

How It Works

  1. Choose a direction: YAML → JSON or JSON → YAML.
  2. Paste your YAML or JSON into the input box.
  3. The output updates live — no button click required.
  4. Copy the result or download it as a .json / .yaml file.

✨ Key Features

  • ✓YAML → JSON conversion (YAML 1.2 spec)
  • ✓JSON → YAML conversion with clean formatting
  • ✓Multi-document YAML support (--- separators)
  • ✓Anchors and aliases (&anchor, *alias) resolved
  • ✓Full type support: strings, numbers, booleans, null, arrays, objects
  • ✓Detailed error messages with line and column info
  • ✓Live conversion as you type
  • ✓Download as .json or .yaml file
  • ✓Pretty-printed output with 2-space indentation
  • ✓100% client-side — no data sent to any server

🎯 Common Use Cases

  • →Converting Kubernetes manifests to JSON for API calls
  • →Editing Docker Compose files as JSON (or vice versa)
  • →Validating YAML config files by converting to JSON
  • →Migrating config formats between tools
  • →Converting GitHub Actions workflows for programmatic use
  • →Preparing OpenAPI/Swagger specs (YAML ↔ JSON)
  • →Converting Ansible playbooks for JSON-based systems
  • →Debugging YAML parsing errors with line numbers

💡 Advanced Tips & Pro Insights

  • ▸YAML anchors (&name) and aliases (*name) let you reuse blocks. This tool resolves them — the output JSON contains the expanded values, not the anchors.
  • ▸Multi-document YAML (--- separators) is used in Kubernetes and CI configs. This tool converts each document to a JSON array.
  • ▸YAML is whitespace-sensitive — use spaces (not tabs) for indentation. This tool shows the exact line/column where parsing fails.
  • ▸In YAML 1.1, "yes"/"no"/"on"/"off" are booleans. In YAML 1.2 (used here), only true/false are booleans — this matches JSON semantics better.
  • ▸For large Kubernetes manifests (1000+ lines), paste into the tool and use the download button — the browser handles it smoothly.

Frequently Asked Questions

Is this converter free?▾
Yes, this YAML to JSON and JSON to YAML converter is completely free with no signup, email, or usage limits.
Is my data safe?▾
Yes, 100% safe. All conversion happens in your browser using the js-yaml library. Your data is never uploaded to any server.
What YAML version is supported?▾
The tool uses js-yaml which supports YAML 1.2. This is the modern standard and matches JSON semantics closely (e.g., yes/no are strings, not booleans).
Does it handle anchors and aliases?▾
Yes. YAML anchors (&name) and aliases (*name) are resolved during conversion. The output JSON contains the fully expanded values — the anchor syntax itself does not appear in JSON (since JSON has no equivalent).
How are multi-document YAML files handled?▾
Multi-document YAML (separated by ---) is converted to a JSON array where each element corresponds to one document. This is common in Kubernetes manifests.
How are dates handled?▾
YAML can represent dates natively (e.g., 2026-09-26). This tool converts them to ISO 8601 date strings in JSON, which is the JSON-compatible representation.
Why does my JSON have errors?▾
JSON is strict: no trailing commas, no comments, no unquoted keys, no single quotes. If you have JSON with these features, it is actually JSON5 or YAML — use the YAML → JSON direction instead.
Can I convert Kubernetes manifests?▾
Yes. Paste a full Kubernetes YAML manifest (including multi-document ones with ---) and the tool produces valid JSON suitable for kubectl --dry-run=server or direct API calls.