JSON will appear here...
Convert YAML configuration files to JSON format. Supports nested objects, arrays, and basic data types.
What is YAML to JSON Converter?
YAML (YAML Ain't Markup Language) is a human-friendly data serialization format that relies on indentation and key: value syntax, making it the default choice for configuration files in Docker Compose, Kubernetes, CI/CD pipelines, and many cloud-native tools. JSON (JavaScript Object Notation) is its machine-optimized counterpart, using braces, brackets, and quoted strings to represent the same data structures. While both formats encode identical information — objects, arrays, strings, numbers, booleans, and null — they serve different audiences: YAML for humans writing configs, JSON for APIs and programs consuming data. This converter transforms YAML into formatted JSON while preserving all nested structures, data types, and hierarchy. It handles nested objects, arrays (dash-prefixed items), quoted and unquoted strings, numeric values, booleans, and null representations.
How to Use
- Paste your YAML content into the input area — this works with Docker Compose files, Kubernetes manifests, CI configs, and any valid YAML
- Click 'Convert' to parse the YAML and transform it into formatted JSON
- Review the JSON output in the right panel — it is automatically indented for readability
- Copy the JSON and use it in your application, API request, or database import
- If conversion fails, check that your YAML uses consistent indentation (same number of spaces per level) and that all keys have colons
Why Use This Tool?
Tips & Best Practices
- YAML uses consistent indentation for nesting — always use the same number of spaces per level (2 is standard)
- Array items start with a dash and space (- item), which becomes a JSON array element
- Strings can be quoted or unquoted in YAML, but JSON always quotes them — the converter handles this automatically
- YAML null (~) and the word null both become JSON null
- Numbers and booleans are auto-detected from their format and converted to the correct JSON type
Frequently Asked Questions
What YAML features are supported?
Key-value pairs, nested objects via indentation, arrays with dash prefixes, quoted and unquoted strings, numbers, booleans (true/false), and null values. Advanced features like anchors (&anchor), aliases (*alias), multi-line block scalars (|, >), and complex type tags may not convert correctly with this simplified parser.
When should I NOT use this converter?
If your YAML uses advanced features like anchors and aliases for reusable content, multi-line block scalars with indentation indicators, or custom type tags, this simplified parser may produce incorrect output. For complex YAML, use a full-featured parser like js-yaml or PyYAML in a scripting environment.
Why convert YAML to JSON?
Many APIs, databases, and cloud services require JSON input. Configuration files written in YAML (which is easier for humans to write and read) need conversion for systems that only accept JSON. Common scenarios include submitting Kubernetes configs to APIs, converting Docker Compose files for programmatic processing, and preparing CI/CD configuration for tools that consume JSON.
Is my data sent to a server?
No. All parsing and conversion happens entirely in your browser. Your YAML content never leaves your device, making this safe for files containing sensitive configuration like passwords or API keys.
How are arrays represented in the conversion?
YAML arrays use the dash prefix (- item). Each dash-prefixed line becomes an element in a JSON array. Nested arrays work with proper indentation. For example: items:\n - apple\n - banana becomes {"items": ["apple", "banana"]}.
What if conversion fails?
Common issues include inconsistent indentation, missing colons after keys, and invalid value formats. Verify that your YAML uses the same number of spaces for each indentation level, that every key has a colon, and that strings with special characters are properly quoted.
Real-world Examples
Docker Compose configuration to JSON
Converting a Docker Compose YAML file to JSON for use in a container orchestration API that accepts only JSON payloads.
version: "3.8"
services:
web:
image: nginx:latest
ports:
- "80:80"
restart: always
db:
image: postgres:15
environment:
POSTGRES_PASSWORD: secret
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:{
"version": "3.8",
"services": {
"web": {
"image": "nginx:latest",
"ports": ["80:80"],
"restart": "always"
},
"db": {
"image": "postgres:15",
"environment": {
"POSTGRES_PASSWORD": "secret"
},
"volumes": ["pgdata:/var/lib/postgresql/data"]
}
},
"volumes": {
"pgdata": null
}
}GitHub Actions workflow to JSON
Converting a CI/CD workflow definition from YAML to JSON for programmatic analysis or submission to a workflow management API.
name: CI Pipeline
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm install
- run: npm test{
"name": "CI Pipeline",
"on": {
"push": {
"branches": ["main"]
}
},
"jobs": {
"build": {
"runs-on": "ubuntu-latest",
"steps": [
{"uses": "actions/checkout@v4"},
{"run": "npm install"},
{"run": "npm test"}
]
}
}
}