YAML to JSON Converter
Paste YAML (including multi-document files) and get JSON instantly. Errors point to the exact line and column.
What this converter does
YAML is the format of choice for configuration: Kubernetes manifests, Docker Compose, GitHub Actions, OpenAPI specs and Ansible. But many programs only accept JSON: REST APIs, jq, JSON Schema validators, browser code and most databases. This tool reads YAML and gives you the equivalent JSON, so you can send a fixture to an API, validate a manifest against a schema or inspect a config with JSON tooling.
YAML is a much larger language than it looks. Indentation, flow style ([a, b], {k: v}), block scalars, anchors and multiple documents in one file all change how a file is read. The converter uses the yaml library, a full implementation of the specification, instead of line-by-line guesswork, so what you get is what any compliant parser would produce.
How to use it
- Paste YAML into YAML input, or press Load example.
- The JSON output updates as you type. If the YAML is invalid, a red message shows the line, column and reason.
- If the file contains several documents, use Documents to output all of them as an array or only one.
- Choose the JSON indent (2 spaces, 4 spaces or minified), then Copy JSON or Download .json.
Worked example
This input uses an anchor, an alias and a folded block scalar:
worker:
image: python:3.12
command: >
python worker.py
--queue default
environment: &env
DEBUG: "false"
ZIP: "02134"
beat:
environment: *envThe JSON output (2 spaces) is:
{
"worker": {
"image": "python:3.12",
"command": "python worker.py --queue default\n",
"environment": {
"DEBUG": "false",
"ZIP": "02134"
}
},
"beat": {
"environment": {
"DEBUG": "false",
"ZIP": "02134"
}
}
}The folded scalar > joined its two lines with a space and kept one final newline. The alias *env was replaced by a full copy of the anchored mapping. The quoted values stay strings: "02134" keeps its leading zero.
Options and type rules
- JSON indent – 2 or 4 spaces for reading, Minified for the smallest payload.
- Documents – appears only when the input contains --- separators. "All as an array" wraps every document in a JSON array in file order.
- YAML 1.1 types – off by default, following YAML 1.2: only true/false are booleans and 2024-01-01 stays a string. When on, yes/no/on/off become booleans, 0755 is octal (493) and dates become ISO timestamps. A %YAML 1.1 directive in the file has the same effect.
Limitations
- Comments are lost, because JSON cannot store them.
- .inf and .nan have no JSON form and become null (a warning is shown).
- Integers above 253 lose precision as JavaScript numbers.
- Duplicate keys are an error, not silently overwritten. Alias expansion is capped to stop maliciously recursive files from freezing the page.
- Inputs over 5 MB are rejected.
Tips and common mistakes
- Tabs are not allowed for indentation in YAML. If you see an indentation error on a line that looks fine, check for a tab.
- Quote version numbers such as "1.10": unquoted, 1.10 is the number 1.1 and the trailing zero is lost.
- To go back the other way use the JSON to YAML converter, and to browse a large result try the JSON Viewer.
Frequently Asked Questions
Which YAML features are supported?
The converter uses the yaml library, a complete YAML parser. Block and flow collections, quoted keys, block scalars (| and >), anchors and aliases, comments, tags and multi-document files separated by --- are all handled.
What happens with a file that contains several YAML documents?
When the input has more than one document, a Documents selector appears. You can output all of them as a JSON array (the default) or pick a single document, such as one resource from a multi-resource Kubernetes file.
Why does yes stay a string instead of becoming true?
YAML 1.2, the current specification, only treats true and false as booleans. Tick YAML 1.1 types if your file was written for a YAML 1.1 parser such as PyYAML, where yes/no/on/off are booleans and 0755 is an octal number.
How are errors reported?
Invalid YAML shows the line and column of the first problem, for example a bad indent, an unclosed bracket or a duplicate key. No JSON is produced until the error is fixed.
Are comments kept in the JSON?
No. JSON has no comment syntax, so # comments are dropped. Anchors and aliases are expanded into full copies of the referenced data.
Is my YAML uploaded to a server?
No. Parsing happens entirely in your browser, so configuration files with secrets or internal hostnames never leave your device.
Related tools
- Excel to CSV ConverterConvert Excel spreadsheets (XLSX/XLS) to CSV format. Supports multiple sheets, custom delimiter, and UTF-8 output.
- CSV to Excel ConverterConvert CSV files to Excel spreadsheets (XLSX) directly in your browser. Auto-detects delimiter and infers column types.
- JSON to YAML ConverterConvert JSON objects to YAML format for configuration files, CI/CD pipelines, or scripts. Live preview, copy, and download.
- Markdown to PDF ConverterConvert Markdown documents to styled PDF directly in your browser. Print-ready output with code blocks, headings, and lists. No upload needed.
- CSV to SQL Insert GeneratorConvert CSV files into SQL INSERT statements. Configurable table name, dialect (MySQL/PostgreSQL/SQLite), and batch size.
- HTML Table to CSVExtract HTML tables and convert them to CSV format. Paste HTML and download CSV instantly. Ideal for scraping and data extraction.
All Converters tools · Found a bug or a wrong result? Report it.