YAML to JSON
Convert YAML into JSON.
How to use YAML to JSON
What this tool does
This tool reads a YAML document and rewrites it as JSON. YAML and JSON describe the same kinds of data — objects (mappings), arrays (sequences), strings, numbers, booleans and null — but YAML is designed to be written by hand, while JSON is the format most APIs, build tools and JavaScript code actually consume. The converter parses your YAML, builds the equivalent data structure, and serialises it as clean, pretty-printed JSON with the indentation you choose. Everything happens in your browser; no file is uploaded.
Why you might need it
YAML is everywhere in modern tooling: CI pipelines, Kubernetes manifests, Docker Compose files, Ansible playbooks and application config all use it. But plenty of programs only speak JSON. You might need to feed a YAML config into a JSON-only API, paste a fixture into a JavaScript test, validate a manifest with a JSON Schema tool, or simply read a deeply nested YAML file in a format where the brackets make the structure unambiguous. Converting to JSON also flushes out hidden problems — anchors, aliases and type coercion all get resolved, so what you see is exactly what a parser will see.
How to use it
- Paste your YAML into the input box, or drop a
.yamlor.ymlfile onto it. - Choose the JSON indentation: 2 spaces, 4 spaces, or tabs.
- Click Convert to JSON, or press Ctrl/Cmd + Enter.
- The JSON appears below; use the copy button to grab it.
- If the YAML is malformed, a clear error names the line and column to fix.
The Load sample button drops in a small YAML document so you can see the conversion immediately, and the byte counters show how the size changes.
Common pitfalls
The number-one source of errors is indentation. YAML uses spaces to express nesting, and it does not allow tab characters for indentation — a tab pasted from another editor will break parsing even though it looks fine. Keep indentation consistent: two spaces per level is the usual convention.
The second surprise is type coercion. YAML guesses types from unquoted text.
yes, no, true, false, on and off all become booleans; a bare 123
becomes a number; an empty value or null becomes JSON null. A version string
like 1.10 written without quotes parses as the number 1.1. If a value must
stay a string — a ZIP code, a country code, a version — quote it in the YAML
before converting. Finally, this tool converts one document; a file with ---
separators holds several, and only the first is read.
Tips and advanced use
When you are debugging a config that “should work”, converting it to JSON is a fast sanity check: the JSON output shows the exact structure the YAML parser produced, including any anchors that were expanded, so a misplaced key jumps out immediately. Round-tripping is useful too — convert YAML to JSON here, then back again, and compare; if a value changed, you have found an unintended type coercion. Because the conversion is fully client-side, you can safely process manifests that contain access tokens, database URLs or internal service names without any of it leaving your machine.
Frequently asked questions
Is my YAML sent to a server?
Why does my YAML show as invalid?
How are YAML data types converted to JSON?
Can it handle multi-document YAML files?
Why did my unquoted value change type?
Related tools
JSON to YAML
Convert JSON into readable YAML.
Base64 Encoder & Decoder
Encode and decode Base64, with full UTF-8 support.
URL Encoder & Decoder
Encode and decode URL-safe text.
HTML Encoder & Decoder
Encode and decode HTML entities.
JWT Decoder
Decode and inspect JSON Web Token headers and payloads.
Regex Tester
Test regular expressions with live match highlighting.