YAML ⇄ JSON Converter
Convert between YAML and JSON, with formatting and validation. It converts as you paste, and syntax errors show a line number — handy for a quick look at a config file. Nothing leaves your browser.
How to use the YAML ⇄ JSON converter
New here? Start by clicking one of the "Examples (click to try)" chips above the input — a sample loads and the result shows right away. After that, just paste into the text area above. It converts live as you type, so there's no button to press. Press "⇅ Swap" to move the current output into the input and convert the other way.
Example: convert YAML to JSON
Paste a Docker Compose-style YAML like this:
services:
web:
image: nginx:latest
ports:
- "8080:80"
environment:
DEBUG: falseIn "YAML → JSON" mode it converts to (2-space indent):
{
"services": {
"web": {
"image": "nginx:latest",
"ports": [
"8080:80"
],
"environment": {
"DEBUG": false
}
}
}
}Switch to "JSON → YAML" and the same JSON turns back into YAML.
- YAML → JSON: reads YAML and outputs formatted JSON. Choose 2- or 4-space indentation.
- JSON → YAML: reads JSON and outputs block-style YAML. The indent width (2 or 4 spaces) applies here too.
- Validation: on a syntax error, it shows a message with an estimated line number.
- ⇅ Swap: moves the output into the input and flips the direction — useful for round-trip checks.
When it comes in handy
- Inspecting CI config (GitHub Actions, GitLab CI), Docker Compose, or Kubernetes manifests
- Feeding YAML config into a tool that only accepts JSON
- Turning JSON config into YAML that's easier to read and edit by hand
- Isolating YAML errors caused by misaligned indentation or stray tabs
To format and validate JSON on its own, see the JSON Formatter; to compare two JSON documents, try the JSON Diff.