YAML ↔ JSON Converter
Convert between YAML and JSON in either direction instantly. Built on js-yaml for full YAML 1.2 specification support including anchors, aliases, multi-line strings, and complex nested structures. Essential for DevOps work with Kubernetes manifests, GitHub Actions workflows, OpenAPI specifications, and Docker Compose files.
What does this tool do?
The YAML-JSON converter provides bidirectional translation between the two most common data serialization formats. JSON to YAML produces clean, readable YAML with appropriate quoting and block styles. YAML to JSON handles the full YAML 1.2 specification including advanced features like anchors (&) and aliases (*), merge keys (<<), multi-line string styles (literal | and folded >), and complex type tags. The tool validates syntax as you type, reporting line and column information for errors.
How it works
The tool uses the js-yaml library compiled for browser use. For YAML to JSON: js-yaml parses the YAML document into JavaScript objects, handling all YAML-specific features (anchors resolve to referenced values, aliases are expanded). JSON.stringify then serializes to JSON with configurable indentation. For JSON to YAML: JSON.parse converts to objects, then js-yaml.dump generates YAML with intelligent formatting (deciding between flow and block styles, handling quotes appropriately). Multi-document YAML files (--- separated) are converted to JSON arrays.
Features
- Bidirectional: YAML → JSON and JSON → YAML
- Full YAML 1.2 support via js-yaml
- Configurable JSON indent (2/4/8 spaces)
- Validates and shows parse errors with line/column
- Handles anchors, aliases, merge keys
- Multi-document YAML to JSON array
- Live conversion as you type
How to use
- 1
Select direction
Choose YAML → JSON to parse YAML into JSON, or JSON → YAML for the reverse conversion.
- 2
Paste your input
Enter valid YAML or JSON. Output updates instantly as you type, or use the convert button for large inputs.
- 3
Adjust output format
For JSON output, select indentation (2 spaces is standard). For YAML output, formatting is optimized automatically.
- 4
Review and copy
Check the converted output. If there are syntax errors, the error message indicates line and column for fixing.
Common use cases
Kubernetes configuration
Convert between YAML manifests and JSON for API interactions, debugging, or tooling that requires specific formats.
CI/CD pipeline editing
GitHub Actions, GitLab CI, and other systems use YAML. Convert to JSON for programmatic manipulation, back to YAML for editing.
OpenAPI specification work
OpenAPI specs can be YAML or JSON. Convert between formats based on tooling requirements or team preferences.
Configuration management
Convert application configs between formats for different deployment environments or tooling ecosystems.
Tips & best practices
- YAML is a superset of JSON — any valid JSON is valid YAML. The reverse is not true (YAML has many features JSON lacks)
- YAML comments (lines starting with #) are lost when converting to JSON — JSON has no comment syntax
- Multi-document YAML (separated by ---) becomes a JSON array when converted
- YAML anchors and aliases are resolved (expanded) in JSON output — the reference structure is flattened