YAML to JSON
Convert YAML to JSON online for free. Paste YAML and get JSON instantly, in your browser.
Suggested tools
About YAML to JSON
YAML to JSON converts YAML configuration into JSON for APIs, JavaScript code and tools that only read JSON. It supports anchors, aliases and merge keys (<<), and multiple documents separated by ---.
It follows YAML 1.2 rules, so words like yes, no, on and off stay text instead of becoming booleans. Invalid YAML is reported with its line number. It runs entirely in your browser, so nothing you paste is uploaded.
How to use YAML to JSON
- Paste YAML, upload a .yaml/.yml file or click Sample.
- Press Convert (choose 2 or 4 spaces).
- Copy or download the JSON.
Key features
- Anchors, aliases and merge keys resolved
- YAML 1.2 rules — no surprise booleans
- Multi-document YAML supported
- Line numbers for syntax errors
Example
A GitHub Actions snippet. With YAML 1.2 rules the key "on" stays text instead of becoming true.
name: build
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: npm test
{
"name": "build",
"on": [
"push"
],
"jobs": {
"test": {
"runs-on": "ubuntu-latest",
"steps": [
{
"run": "npm test"
}
]
}
}
}When to use YAML to JSON
- Using YAML configuration in a tool or API that only reads JSON.
- Checking what a YAML file really contains after anchors and merges are applied.
- Converting OpenAPI or CI files for scripts.
Tips and common problems
- Tabs are not allowed for indentation in YAML — replace them with spaces.
- Several documents separated by --- become one JSON array.
- Comments are dropped because JSON has no comments.
Frequently asked questions
JSON has no comments, so they are dropped. All the data is kept.
They are returned together as a JSON array, one element per document.
The most common causes are tabs used for indentation, inconsistent indentation and a missing space after a colon.
Guides
- JSON vs XML vs YAML — JSON vs XML vs YAML compared: strengths, weaknesses and best uses, to help you choose the right data format for APIs, config files and documents.