Convert YAML to JSON
Convert YAML data to JSON format instantly. Supports nested structures, arrays, and all YAML types. 100% client-side.
Paste your YAML config, hit Convert, and get clean JSON back — nested objects, arrays, booleans, all of it mapped correctly. No need to hand-wrap keys in quotes or swap dashes for brackets yourself.
Handles the full YAML 1.2 spec including anchors, aliases, and multi-line strings. Copy the output or download it as a .json file. And everything runs in your browser. Nothing gets uploaded.
How It Works
The tool uses the js-yaml library (YAML 1.2 compliant) to parse your input into a JavaScript object. Then it serializes that object to JSON with proper indentation. Mappings become objects, sequences become arrays, and scalar types like booleans and numbers map directly to their JSON equivalents. The whole thing takes milliseconds.
Examples
Simple Config File
A typical app config with database settings — the kind of thing you’d find in a Docker Compose or CI pipeline.
app:
name: my-api
port: 3000
database:
host: localhost
port: 5432
name: production
{
"app": {
"name": "my-api",
"port": 3000
},
"database": {
"host": "localhost",
"port": 5432,
"name": "production"
}
}
List of Users with Mixed Types
YAML’s yes/no booleans and null values need careful mapping. Here’s how they come out.
users:
- name: Alice
active: yes
role: admin
- name: Bob
active: no
role: ~
{
"users": [
{
"name": "Alice",
"active": true,
"role": "admin"
},
{
"name": "Bob",
"active": false,
"role": null
}
]
}
Nested CI/CD Pipeline Config
A GitHub Actions-style workflow. Deeper nesting, arrays of strings — a good stress test for the converter.
name: Deploy
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm install
- run: npm test
{
"name": "Deploy",
"on": {
"push": {
"branches": ["main"]
}
},
"jobs": {
"build": {
"runs-on": "ubuntu-latest",
"steps": [
{"uses": "actions/checkout@v4"},
{"run": "npm install"},
{"run": "npm test"}
]
}
}
}
Who Uses This
Converting Kubernetes or Docker Compose YAML configs to JSON for API consumption or tooling that only accepts JSON input.
Translating CI/CD pipeline configs (GitHub Actions, GitLab CI) into JSON when debugging or feeding them into validation scripts.
Turning YAML data exports into JSON so they can import them into tools like Python pandas, jq, or spreadsheet converters.
Learning the differences between YAML and JSON by seeing exactly how one maps to the other — indentation to braces, dashes to brackets.
Common Mistakes
YAML doesn’t allow tabs for indentation — only spaces. If you paste from an editor that uses tabs, you’ll get a parse error. Switch your editor to spaces (2 or 4) before copying.
Values like yes, no, on, off get interpreted as booleans. The string 3.0 becomes a number. If you meant them as text, wrap them in quotes in your YAML: "yes", "3.0".
YAML is picky about alignment. If one block uses 2 spaces and a child block uses 3, the parser gets confused. Pick 2 spaces and stick with it throughout the file.
If your YAML has --- separators between documents, only the first document gets converted. Split them up and convert each one separately.
Technical Details
- Processing: 100% client-side — nothing leaves your browser
- YAML Spec: YAML 1.2 via the js-yaml library
- Browser Support: Chrome, Firefox, Safari, Edge
- Output Format: Pretty-printed JSON with 2-space indentation
- Size Limit: No hard limit — depends on your browser’s memory
Frequently Asked Questions
Is YAML to JSON conversion lossless?
For the most part, yes. JSON can represent all the core YAML data types — strings, numbers, booleans, null, arrays, and objects. The main thing you lose is YAML-specific features like comments, anchors/aliases (they get resolved), and explicit typing tags. Date values also become plain strings in JSON since there is no date type.
Why does my YAML boolean turn into true/false instead of yes/no?
YAML treats yes, no, on, off, true, and false all as boolean values. JSON only has true and false. So yes becomes true and no becomes false. If you want them kept as strings, quote them in your YAML: "yes".
Can I convert JSON back to YAML?
Not with this tool — it’s one-way, YAML to JSON. We have a separate JSON to YAML converter that does the reverse. Between the two, you can go back and forth as needed.
Does this work with large YAML files?
It handles files with thousands of lines without issues. Since the conversion runs locally in your browser, speed depends on your device’s memory and CPU. Files over 10MB might slow things down on older hardware, but there’s no enforced size cap.
Is my YAML data safe when using this tool?
Yes. The conversion happens entirely inside your browser tab using JavaScript. Nothing gets sent to any server. No data is stored, logged, or tracked. Close the tab and your data is gone — that’s it.