YAML to JSON Converter
Convert YAML to JSON instantly — free, online, and 100% client-side. Handles nested objects, arrays, multi-document YAML, anchors, and all standard data types.
Convert YAML to JSON Now
Paste your YAML into the editor, click YAML → JSON, and your converted JSON appears instantly. No signup, no upload, no server — everything runs in your browser.
Open the YAML to JSON ConverterHow to Convert YAML to JSON
Paste your YAML
Copy your YAML content and paste it into the editor. Or click Load Sample to try with a real Kubernetes or Docker Compose example.
Click YAML → JSON
Hit the YAML → JSON button. The tool detects your input format automatically and enables the right conversion button.
Copy or Download
Your JSON output appears with syntax highlighting. Copy to clipboard or download as a .json file.
YAML to JSON — Conversion Examples
Side-by-side examples showing how YAML structures map to their JSON equivalents.
Kubernetes Service
YAML Input
apiVersion: v1
kind: Service
metadata:
name: my-service
labels:
app: my-app
spec:
selector:
app: my-app
ports:
- port: 80
targetPort: 8080JSON Output
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "my-service",
"labels": {
"app": "my-app"
}
},
"spec": {
"selector": {
"app": "my-app"
},
"ports": [
{
"port": 80,
"targetPort": 8080
}
]
}
}Application Config
YAML Input
database: host: localhost port: 5432 name: mydb ssl: true server: port: 3000 debug: false features: - auth - analytics - notifications
JSON Output
{
"database": {
"host": "localhost",
"port": 5432,
"name": "mydb",
"ssl": true
},
"server": {
"port": 3000,
"debug": false
},
"features": [
"auth",
"analytics",
"notifications"
]
}What the Converter Handles
All YAML data types
Strings, integers, floats, booleans, null values, and dates are all converted to their JSON equivalents with correct type handling.
Nested objects
Deeply nested YAML mappings become nested JSON objects. Indentation-based nesting is fully preserved in the conversion.
Lists and arrays
YAML sequences (dash-notation lists) become JSON arrays. Both simple value lists and lists of objects are supported.
YAML anchors & aliases
Anchors (&name) and aliases (*name) are resolved before conversion. The output JSON contains the fully expanded data.
Multi-line strings
Literal block scalars (|) preserve newlines. Folded block scalars (>) collapse them to spaces. Both become JSON strings correctly.
Multi-document YAML
Files with multiple --- separated documents are handled. Each document is converted independently to JSON.
Why Convert YAML to JSON?
YAML is the format of choice for configuration files, CI/CD pipelines, and infrastructure-as-code — but most APIs, databases, and programming language libraries prefer JSON. Converting YAML to JSON bridges this gap.
Common scenarios where you need YAML to JSON conversion:
- Kubernetes tooling: Some kubectl plugins, Helm chart tools, and CI systems accept config as JSON rather than YAML manifests.
- API testing: Converting a YAML config to JSON to use as a request body in Postman, Insomnia, or curl.
- Debugging: JSON is easier to inspect in browser devtools and log outputs. Converting YAML to JSON lets you verify the parsed structure.
- CI/CD pipelines: Some pipeline steps accept environment variables or config as JSON strings — converting from your YAML source is a quick fix.
- Data interchange: When sharing configuration data with a service or tool that only speaks JSON.
FAQ
Is this YAML to JSON converter free?
Yes — completely free with no usage limits, no login, and no account required.
Is my YAML data safe?
100%. All conversion happens in your browser using JavaScript. Your YAML is never sent to any server, never stored, and never logged. Once the page loads, it works entirely offline.
What happens to YAML comments during conversion?
Comments are stripped from the JSON output. JSON doesn't support comments, so the converter discards them. The data values and structure are preserved exactly.
Does it handle YAML anchors and aliases?
Yes. Anchors (&anchor) and aliases (*alias) are resolved before conversion. The resulting JSON contains the fully expanded data without any YAML-specific references.
What happens to YAML booleans like 'yes' or 'on'?
YAML 1.1 treats yes/no, true/false, and on/off as booleans. The converter handles these correctly — they become JSON true or false. If you need these as strings, quote them in your YAML source.
Can I convert multi-document YAML (--- separated)?
Yes. The tool handles multi-document YAML files. Each document separated by --- is validated and converted independently.
How is the JSON output indented?
The JSON output uses 2-space indentation by default, which is the most readable standard. You can change the indentation to 4 or 8 spaces using the indent selector in the tool.