YAML to JSON
Convert YAML documents to formatted JSON online with syntax validation. Errors are reported by line, so broken indentation is quick to find and fix.
Runs in your browser · Nothing uploadedFree · No sign-up
Something not working, or missing a feature? Send feedback
About the YAML to JSON
The YAML to JSON converter validates YAML and outputs formatted JSON, which is useful for APIs, JSON Schema checks and seeing exactly how YAML values are interpreted.
Conversion happens in your browser, so your files and records stay private.
How to use the YAML to JSON
- Paste YAML or open a file.
- Fix any error at the reported location.
- Copy or download the JSON.
Example
Input
image: &node node:22
jobs:
test:
image: *node
script: npm test
lint:
image: *node
script: npm run lintResult
{
"image": "node:22",
"jobs": {
"test": {
"image": "node:22",
"script": "npm test"
},
"lint": {
"image": "node:22",
"script": "npm run lint"
}
}
}The &node anchor is defined once and each *node alias is replaced by its value, so the JSON repeats it in full.
Common mistakes
- Numbers that should be strings. version: 1.10 converts to the number 1.1. Quote such values in the YAML ("1.10") to keep them as text.
- Merge keys (<<) are not merged. YAML 1.2 has no merge key, so <<: *defaults is kept as a key named "<<" instead of copying the fields. GitLab CI and Docker Compose apply merges themselves; expand them by hand if your consumer does not.
- Multiple documents. A file with several documents separated by --- converts to more than one JSON value. Split it, or convert one document at a time.
- Indentation errors. The error shows the line and column. Usually one key is indented by a different number of spaces than its siblings.
Works well with the YAML to JSON
- JSON to YAML: convert JSON back to YAML.
- JSON Formatter: reformat or sort the keys of the JSON.
- YAML Validator: validate YAML without converting it.
Frequently asked questions
What happens to comments?
JSON has no comments, so they are dropped.
How are anchors and aliases handled?
They are expanded, so the JSON contains the full repeated values.
Which YAML version is supported?
YAML 1.2, the current version, so only true and false are booleans. yes and no stay strings.
Is my config uploaded?
No. Parsing happens in your browser, so secrets stay on your device.
Guides and tutorials
- JSON & Data Formats
YAML Gotchas: The Norway Problem, Indentation and Other Traps
Why NO becomes false, ZIP codes turn into octal and comments cut passwords short in YAML, with tested examples and simple rules for writing safe YAML.
· 6 min read
- JSON & Data Formats
JSON vs YAML vs XML: Which Data Format Should You Use?
A practical comparison of JSON, YAML and XML: syntax, comments, types, tooling and performance, with clear advice for APIs, config files and documents.
· 5 min read
Related tools
JSON to CSV
Convert JSON arrays to CSV online with automatic column detection, nested object flattening and custom delimiters. Open the result in Excel or Sheets.
CSV to JSON
Convert CSV to a JSON array online with header detection, type inference and delimiter auto-detection. Turn spreadsheet exports into data for APIs and code.
JSON to XML
Convert JSON to well-formed XML online with a configurable root element and attribute support. Validate the input and download the XML file.
XML to JSON
Convert XML to JSON online, keeping attributes and turning repeated elements into arrays. Malformed XML is reported with its location.
JSON to YAML
Convert JSON to clean, human-readable YAML online. Turn API responses and package files into config for Kubernetes, Docker Compose or CI pipelines.
JSON to PHP Array
Convert JSON to a PHP array literal online, using short [] or long array() syntax. Paste API responses straight into PHP code, tests and config files.