YAML to JSON & JSON to YAML Converter (Free, No Upload)
Convert both directions on one page — auto-detect, live conversion, line-number error pinpointing and gotcha warnings. Zero ads, 100% in your browser.
⚠️ Share links embed your data in the URL itself — anyone with the link can read it. Configs often contain secrets (API keys, tokens, passwords), so share links only with people you trust. Conversion itself never leaves your browser: parsing runs locally with js-yaml (YAML 1.2 core schema), zero network requests.
Two-way converter: auto-detect reads your input and converts both directions on one page — no separate pages per direction. Errors are pinned to the exact line and column, and the gotcha panel above warns about silent data changes (007 → 7, .inf → null, duplicate keys, merge keys) before they reach your pipeline.
YAML to JSON and back, on one page
YAML is the language of infrastructure — Kubernetes manifests, GitHub Actions workflows, docker-compose files, Ansible playbooks — and JSON is the language of APIs and pipelines. Moving between them usually means juggling two separate converter pages, uploading secret-bearing configs to ad-heavy sites, and discovering silently mangled values only after a deploy fails. The converter above does both directions on one page with auto-detect: paste either format and it converts live, entirely in your browser, with errors pinned to the exact line and a gotcha panel that flags the silent data changes other tools let through.
TL;DR
- Two-way, one page: YAML → JSON and JSON → YAML with auto-detect — no separate pages per direction.
- Errors pinned down: every failure shows the reason, the line and column, the offending line, and a caret snippet — plus a plain-language hint for the classic cases.
- Gotcha warnings: 007 → 7, .inf/.nan → null, duplicate keys, tabs, merge keys, anchors — flagged before they reach your pipeline.
- Private: parsed locally with js-yaml (YAML 1.2 core), zero ads, zero trackers — verify it in your Network tab.
This tool vs the popular converters
| Property | This tool | codebeautify.org | onlineyamltools.com | transform.tools |
|---|---|---|---|---|
| Bidirectional, one page | Yes — auto-detect | No — separate pages per direction | No — one direction per page | No — separate pages per direction |
| Ads & pop-ups | Zero | Heavy: video ad, ad iframes, sticky banner | None observed | None observed |
| 100% client-side | Yes — verifiable in the Network tab | No — server-side “Save online” features | Yes — stated on the page | Inferred from its open-source repo |
| Error pinpointing | Line + column + caret snippet + hint | Separate validator link, no inline pinpoint | None found | None found |
| Gotcha warnings | Yes — dates, 007, .inf, duplicates, tabs, merge keys | No | No | No |
| Multi-doc → JSON array | One-click toggle | Not offered | Not offered | Not offered |
Conversion gotchas this tool warns about
Most converters fail silently on the values below — the output looks fine and the pipeline breaks later. Every one of these is flagged above the moment it applies:
- 007 → 7. Under YAML 1.2, leading zeros don't make octal anymore (octal needs a 0o prefix), so 007 parses as the number 7. In JSON, 007 isn't even a valid number — quote it as “007” to keep it a string.
- .inf / .nan → null. js-yaml reads them as Infinity and NaN, but JSON has no representation for either, so they are emitted as null. Check any thresholds that relied on infinity.
- Duplicate keys throw. Unlike PyYAML, which silently keeps the last value, js-yaml refuses the document with “duplicated mapping key” — the safe behaviour, surfaced with the exact line.
- Tabs are rejected. The YAML spec forbids tabs in indentation; the parser throws. This tool detects tabs and rewrites them as spaces with one click.
- yes / no / on / off stay strings. YAML 1.2 core only recognises true/false as booleans — 1.1-era tools coerced the longer list. Downstream 1.1 systems may still coerce, so quote them when it matters.
- Merge keys aren't expanded. The 1.2-core default parser treats <<: as a literal key instead of merging the referenced mapping — you'll see a real “<<” key in the JSON, which is the warning, not a bug.
- Anchors & aliases are flattened. &base / *base references are resolved into plain copies — JSON has no alias concept, so repeated data is expected, not an error.
Why these gotchas exist
YAML 1.1 and 1.2 disagree on the small things that change data: 1.1 coerced yes/no/on/off to booleans and parsed unquoted dates into timestamps; 1.2 tightened both. This tool parses with the YAML 1.2 core schema (js-yaml v5), which is why dates stay strings and yes stays “yes” here. The warnings exist because your downstream tools may still be 1.1-flavoured — knowing what the parser did is the difference between a clean deploy and a mystery outage.
Related tools
Configs travel with other formats — validate structure with the JSON Formatter, move payloads between systems with the Base64 Converter, and inspect signed tokens with the JWT Decoder.
FAQs
How do I convert YAML to JSON online?+
Paste your YAML into the input pane above — with auto-detect on, the tool recognises YAML and converts it to JSON live, as you type. Choose 2-space, 4-space, tab or compact indent, then copy or download the .json file. Nothing is uploaded: parsing runs entirely in your browser with the js-yaml library.
How do I convert JSON to YAML online?+
Paste valid JSON and the tool converts it the other way: switch the direction to "JSON → YAML" or let auto-detect do it. Pick 2- or 4-space indentation and an optional sort-keys pass, then copy or download the .yaml file. Risky strings are quoted conservatively — "yes" becomes 'yes' so YAML 1.1-era readers don't misread it as true.
Is JSON valid YAML?+
Yes — any valid JSON document is valid YAML under YAML 1.2, which defines itself as a natural superset of JSON. That is why auto-detect works: JSON input is parsed first as JSON, and the same parser family handles both. (The one historical caveat: YAML 1.1 is not a strict superset, so very old parsers can disagree on edge cases.)
Why are tabs not allowed in YAML?+
Because the YAML spec forbids them in indentation (§6.1): tab widths render differently in different editors, so the same file would parse into different structures on different machines. The parser throws "tab characters must not be used in indentation" — this tool detects tabs before you even convert and offers to rewrite them as spaces with one click.
YAML vs JSON — which is better?+
Neither — they serve different readers. YAML is for humans: comments, anchors, multi-line strings and readable indentation, which is why Kubernetes manifests, GitHub Actions workflows, docker-compose files and Ansible playbooks use it. JSON is for machines: stricter, more compact, and parsed natively by every language. Convert between them when the human-friendly file has to meet the machine-friendly pipeline.
Does this tool validate YAML?+
Yes. If the input is invalid you get a green-to-red state change instantly: the "Valid YAML" badge disappears and the exact failure is shown — the reason, the line and column, the offending line, and a caret snippet pointing at the problem, plus a plain-language hint for the common cases (bad indentation, tabs, duplicate keys, multiple documents).
How do I convert a Kubernetes YAML manifest to JSON?+
Paste the manifest and the tool converts it to JSON live. Manifests often bundle several resources separated by --- lines; turn on "Multi-doc → JSON array" to convert every document at once into a single JSON array instead of getting a single-document error. Watch the gotcha panel — things like 007 → 7 or .inf → null can silently change resource values.
Is the data I paste uploaded anywhere?+
No. Conversion runs 100% in your browser with js-yaml — open your Network tab while converting and you will see zero requests. This matters because configs carry secrets: API keys, tokens, passwords. One caution that applies to every client-side tool: share links embed your data in the URL itself, so anyone with the link can read it — share only with people you trust.
Why do yes, no, on, and off sometimes become true or false?+
That is the YAML 1.1 vs 1.2 split. YAML 1.1 treated yes/no/on/off (and y/n) as booleans; YAML 1.2 core only recognises true/false (plus True/False/TRUE/FALSE). This tool parses with the 1.2 core schema, so unquoted yes stays the string "yes" and warns you about it — important because downstream 1.1-era systems (including many Kubernetes toolchains) may still coerce it. Quote it ("yes") when a 1.1 reader must see a string.
What happens to duplicate keys in YAML?+
The YAML spec leaves the behaviour to the parser, and parsers disagree. js-yaml — the library this tool uses — throws "duplicated mapping key" and refuses the document, which is actually the safe behaviour: PyYAML silently keeps the last value and drops the earlier one, which can hide config mistakes. This tool surfaces the error with the exact line and suggests renaming one of the keys.
More free tools
Want guides and tips? Visit the ToolsOfWeb blog or go back to the homepage.
