YAML ⇄ JSON
YAML to JSON and back.
About YAML ⇄ JSON
YAML and JSON describe the same data with different punctuation, and converting between them by hand is a reliable way to introduce mistakes. A missing space after a dash, a stray tab, or an unquoted version number that looks like a float will break a pipeline or a deployment. This converter parses one side and prints the other, so nesting, lists, booleans, and numbers all come through exactly as they were written. It works in both directions: paste YAML to get JSON for a script or API payload, or paste JSON to get readable YAML for a configuration file. The parse runs entirely in your browser, so private configuration data never leaves your machine.
How to Use YAML ⇄ JSON
Pick the direction
Choose YAML to JSON or JSON to YAML at the top. You can flip the direction at any time without retyping anything, since the input stays in place.
Paste or open your data
Type or paste into the left box, or click Open file to load a .yaml, .yml, or .json file from your device. The result appears on the right as you type.
Fix any reported errors
If the input cannot be parsed, a red message appears below the boxes and points at the problem, such as a bad indentation level or a missing colon. Correct the input and the result refreshes automatically.
Copy or download the result
Click Copy to put the converted text on your clipboard, or Download to save it as a .json or .yaml file with the right name.
Why Use YAML ⇄ JSON: Common Use Cases
Writing GitHub Actions and CI pipelines
Workflow files are written in YAML, but it is easier to reason about the object structure in JSON first. Draft the structure here, convert it, then indent it back into the workflow file.
Feeding config into scripts
Python, Node, and shell scripts read JSON natively, while humans maintain YAML better. Convert the deployment file to JSON before handing it to an automation step.
Debugging a broken YAML file
When a Kubernetes manifest or Docker Compose file refuses to load, running it through the parser shows exactly where the structure stops making sense.
Cleaning up API responses
A JSON response from an API can be converted to YAML to read nested fields quickly, then converted back once you know what to extract.
YAML ⇄ JSON Specifications
| Input Formats | YAML (.yaml, .yml), JSON, Plain text paste |
|---|---|
| Output Formats | JSON (2-space indent), YAML (2-space indent) |
| File Size Limit | No strict limit (dependent on device memory) |
| Processing Engine | 100% Client-side (Runs locally in your browser) |
| Data Retention | Files never leave your device |
| Batch Processing | Single file processing |
Tips for YAML ⇄ JSON
Version numbers in YAML often need quotes. Writing
version: 1.10stores a number and drops the trailing zero, whileversion: "1.10"keeps the string intact.Tabs are not valid indentation in YAML. If a paste keeps failing, replace tabs with two spaces, or clean stray lines first with Line Tools.
Large JSON from an API is easier to inspect after formatting. Run it through JSON Formatter before converting if the original is one long line.
Tabular data does not belong in YAML. For spreadsheets, use CSV to JSON instead, which understands rows and headers.
Keep a comment-free copy for machines. YAML comments are useful for people but disappear during conversion, so keep the original file as documentation.
Frequently Asked Questions
Is YAML valid JSON?
No. They look similar for simple data, but YAML allows comments, unquoted strings, and indentation-based nesting, none of which exist in JSON. Any JSON document can be parsed as YAML, but a YAML document usually needs conversion before a strict JSON parser accepts it.
Why did my version number change?
YAML treats bare numbers as numbers, so 1.10 becomes 1.1 and 0755 becomes 493. Wrap the value in quotes in the YAML source to force it to stay a string through the conversion.
Does the converter support anchors and aliases?
Yes. YAML anchors marked with an ampersand and references marked with an asterisk are expanded into full copies in the JSON output, because JSON has no way to express them. The converted result contains the resolved data.
How are multi-line strings handled?
Block scalars written with the vertical bar keep their line breaks and become a single JSON string with newline characters. Folded scalars written with the greater-than sign have their lines joined into one paragraph.
Is my configuration data uploaded anywhere?
No. The parser is a JavaScript library loaded once with the page, and every conversion runs in your browser. Config files often contain hostnames and credentials, so nothing is sent to a server.
Can I convert a whole folder of files at once?
Not in one step here. This tool converts one document at a time so errors stay easy to read. For bulk conversion, run each file through the tool, or convert the directory with a script once you have verified the format.