Convert JSON to YAML and YAML to JSON in your browser
JSON and YAML describe the same kind of data — nested maps, lists, strings, numbers, and booleans — but they look very different and get used in different places. If you spend any time near APIs, container files, or CI pipelines, you eventually need to turn one into the other. This page does that conversion both ways, entirely inside your browser, so the data you paste never leaves your machine.

What JSON is and where it lives
JSON (JavaScript Object Notation) is a strict, bracket-and-brace format built for machines first. Every object is wrapped in {}, every array in [], keys and string values are double-quoted, and items are separated by commas. It is the default wire format for REST and GraphQL APIs, the body of most webhooks, the shape of NoSQL documents, and the thing your fetch call returns. Nearly every language parses it out of the box, which is exactly why it won the API layer: JSON.parse in JavaScript, json in the Python standard library, and equivalents everywhere else. The trade-off is that JSON is verbose to write by hand and forbids comments, so it is a poor format for files a human edits all day.
What YAML is and where it lives
YAML (YAML Ain't Markup Language) was designed for the opposite priority: humans first. It drops the braces and quotes, uses indentation to express nesting, and lets you write comments with #. That readability is why it became the lingua franca of configuration. Docker Compose files, Kubernetes manifests, GitHub Actions and GitLab CI workflows, Ansible playbooks, and countless app config files are all YAML. A typical YAML document is noticeably shorter than the equivalent JSON and far easier to diff in a pull request. The cost of that elegance is fragility, which is where conversion gets interesting.
The key differences that matter
Three differences drive almost every conversion decision. First, whitespace is significant in YAML and meaningless in JSON. YAML uses spaces — never tabs — to denote structure, so a single misaligned space can silently change the meaning of a document. JSON does not care about indentation at all. Second, YAML supports comments and JSON does not. Any # comment in YAML simply disappears when you produce JSON, because there is nowhere to put it. Third, YAML has richer, implicit typing. It happily reads dates, timestamps, and null in several spellings, and it guesses types from unquoted values. JSON has a small, explicit type set and no ambiguity. Note also that JSON is technically a subset of YAML 1.2, which is why valid JSON usually parses cleanly as YAML, but the reverse is not guaranteed.

Conversion gotchas to watch for
Round-tripping is not always lossless, and it pays to know where things break:
- The Norway problem. Under YAML 1.1 rules, unquoted
NOparses as the booleanfalse, andyes,on, andoffbecome booleans too. A country code or a switch label can flip totrue/falsebefore you notice. Quote values you mean as strings. - Number coercion. A version like
3.10can lose its trailing zero and become3.1, and1.0becomes a number even when you wanted text. Quote version strings and IDs. - Anchors and aliases vanish. YAML's
&anchorand*aliasreferences have no JSON equivalent. A good converter expands them into their full value, so the data is correct but the deduplication is gone — JSON to YAML to JSON will not rebuild the original anchors. - Comments and block scalars. Comments are dropped going to JSON. Multi-line block scalars (
|and>) collapse into ordinary JSON strings with\nescapes, so the visual formatting intent is lost. - Indentation when going back to YAML. JSON does not encode indentation, so the converter picks a consistent style. Review it before pasting into a tab-sensitive tool.
Why local-only matters
Config files and API payloads are exactly the kind of thing that should not be uploaded to a random server: they often carry hostnames, tokens, internal service names, or customer data. This converter runs the parse-and-emit step in your browser with JavaScript. Nothing is sent to a backend, nothing is logged, and the tool works offline once the page has loaded. Paste a Kubernetes secret or a CI workflow with confidence that it stays on your machine.
Need related tooling? Browse the full set of data converters, clean up messy input with the JSON formatter, and come back here whenever you need to move between the API world and the config world.
Frequently asked questions
Is my data uploaded anywhere?
No. The conversion happens entirely in your browser using local JavaScript. Your JSON or YAML is never sent to a server, so secrets and config files stay private.
Why did my YAML value true or false change unexpectedly?
YAML 1.1 treats unquoted words like yes, no, on, and off as booleans — the Norway problem. Wrap any value you mean as a string in quotes so it survives conversion as text.
What happens to my comments when I convert YAML to JSON?
JSON has no comment syntax, so all hash comments are stripped during conversion. If you need to preserve notes, keep your authoritative copy in YAML.
Are YAML anchors and aliases preserved?
They are expanded into their full values because JSON has no reference mechanism. The data stays correct, but the deduplication is not recoverable when you convert back to YAML.
Can I convert JSON to YAML as well as YAML to JSON?
Yes, the tool works in both directions. Paste JSON to get YAML, or paste YAML to get JSON, and the converter detects and emits the other format.
Why does YAML break when I use tabs?
YAML requires spaces for indentation and rejects tabs. If a paste fails to parse, replace tab characters with spaces and keep indentation consistent.
