YAML to JSON Converter

Convert YAML data to JSON format instantly. Supports anchors, aliases, and nested structures.

Safe conversion with no data sent to server

Last updated: March 2026

Indent:

What is YAML to JSON Conversion?

YAML (YAML Ain't Markup Language) is a human-friendly data serialization format widely used for configuration files in modern DevOps and development tools. Docker Compose, Kubernetes manifests, GitHub Actions workflows, Ansible playbooks, and many CI/CD systems all use YAML as their primary configuration format. YAML's indentation-based syntax makes it readable and writable without the visual clutter of brackets and braces.

JSON (JavaScript Object Notation) is the standard data interchange format for web APIs, configuration in JavaScript/TypeScript ecosystems, and data storage in document databases like MongoDB. While YAML and JSON can represent the same data structures (objects, arrays, strings, numbers, booleans, null), their syntax differs significantly. YAML uses indentation and colons, while JSON uses braces, brackets, and explicit quoting.

Converting YAML to JSON is essential when you need to use YAML-defined configurations in JSON-consuming tools, validate YAML structure against JSON schemas, or integrate YAML-based configuration with APIs and services that expect JSON input. The conversion preserves all data types and nested structures, including YAML-specific features like anchors and aliases that are resolved into their expanded form in JSON.

How to Use This Tool

Paste your YAML content into the input text area. Select your preferred JSON indentation level (2 or 4 spaces) for readability. Click "Convert to JSON" to parse the YAML and generate equivalent JSON output. The result appears in the output area where you can review, copy to clipboard, or download as a .json file.

The converter handles all standard YAML features including nested mappings, sequences (arrays), multi-line strings (literal and folded block scalars), anchors and aliases, flow collections, and all YAML data types (strings, integers, floats, booleans, null, and dates). If your YAML has syntax errors such as inconsistent indentation or invalid characters, the tool will display a descriptive error message to help you fix the issue.

Common Use Cases

  • Converting Kubernetes YAML manifests to JSON for use with kubectl's JSON output mode or API calls
  • Transforming Docker Compose YAML files to JSON for programmatic processing
  • Converting GitHub Actions workflow YAML to JSON for schema validation
  • Migrating Ansible playbook configurations to JSON format for integration testing
  • Preparing YAML configuration data for import into JSON-based databases like MongoDB or CouchDB
  • Validating YAML structure by converting to JSON and applying JSON Schema checks
  • Converting CloudFormation YAML templates to JSON for AWS compatibility
  • Transforming YAML-based API specifications (OpenAPI/Swagger) to JSON for tooling compatibility

FAQ

What happens to YAML anchors and aliases during conversion?

YAML anchors (&name) and aliases (*name) are fully resolved during conversion. The referenced data is duplicated in the JSON output wherever the alias appears. This means the JSON output may be larger than the YAML input, but all data is preserved accurately.

How are YAML multi-line strings handled?

YAML supports literal block scalars (|) that preserve newlines and folded block scalars (>) that join lines with spaces. Both are converted to JSON strings with appropriate newline characters (\n) embedded. The resulting JSON string accurately represents the original multi-line content.

Does this tool support multi-document YAML?

YAML files can contain multiple documents separated by ---. This tool processes the first document in the input. If you need to convert multiple YAML documents, separate them and convert each one individually, or combine them into a single YAML array before conversion.

Why does YAML "yes" convert to true in JSON?

YAML 1.1 interprets certain strings as boolean values: yes, no, on, off, true, and false (case-insensitive) are all treated as booleans. If you need these as literal strings in JSON, wrap them in quotes in your YAML: "yes" instead of yes. YAML 1.2 is stricter and only recognizes true and false.