JSON ⇄ YAML Converter
Convert between JSON and YAML in either direction. Runs in your browser — your config never leaves your device.
How to Convert JSON to YAML
- Paste your JSON or YAML into the left box.
- Pick the direction — JSON → YAML, or YAML → JSON.
- The result appears on the right as you type.
- Adjust indentation if you need to.
- Copy the result or download it as a file.
Everything runs in your browser — your config never leaves your device.
What survives the round trip, and what does not
YAML is a superset of JSON, so JSON to YAML is lossless. The other direction is not, and knowing exactly where it loses things saves a confusing afternoon.
| YAML feature | Becomes JSON as |
|---|---|
| Comments (# …) | Dropped entirely. They are not data, so JSON has nowhere to put them. The single most common surprise. |
| Anchors and aliases (&x, *x) | Expanded — the referenced value is copied in wherever it was aliased. The result is correct but larger, and the link is gone. |
| Multiple documents (---) | An array, one element per document. Going back, tick "Array as multiple documents" to restore the split. |
| Non-string keys (1: a, true: b) | Stringified, because JSON object keys must be strings. "1" and 1 become the same key, which can silently collide. |
| Dates (2026-09-26) | An ISO string. YAML parses it as a timestamp type JSON does not have. |
| Multi-line blocks (| and >) | A single string with newlines preserved or folded, as the block style specified. Round-trips fine, just less readable. |
Values that change type on the way through
YAML guesses the type of an unquoted value, and the guesses are not always the ones you want. Every row below was measured against this converter, not quoted from a spec:
| YAML | JSON here | Watch out |
|---|---|---|
| version: 1.10 | 1.1 | The trailing zero is gone — it was read as a number. Quote version strings. |
| mode: 014 | 14 | YAML 1.2 dropped leading-zero octal, so this is fourteen, not twelve. Use 0o14 for octal. |
| d: 2026-09-26 | "2026-09-26T00:00:00.000Z" | Parsed as a timestamp, then serialised as an ISO string. A bare date does not survive as written. |
| a: ~ | null | Tilde, the word null, and an empty value are all null. |
| t: 12:30 | "12:30" | Stays a string here. Under YAML 1.1 it could be read as a sexagesimal number. |
| ENABLED: yes | "yes" | Stays a string here — but not everywhere. See below. |
The Norway problem, and why this tool does not show it
The famous YAML bug: a list of country codes where NO — Norway — silently
becomes the boolean false. It happens because YAML 1.1 treats
yes, no, on and off as booleans alongside
true and false.
This converter does not do that. It runs js-yaml 4, which follows the
YAML 1.2 core schema, where only true and false are booleans —
so NO, yes, on, off, y and
n all stay strings. Verified, not assumed: the sample config above sets
ENABLED: yes and it comes out as "yes".
That is a reason to be more careful rather than less. PyYAML defaults to YAML 1.1
and does turn no into False, and plenty of CI systems and
config loaders do the same. So the identical file can mean two different things depending on
which tool reads it, and a value that looks fine here can still break in a Python service.
The fix costs nothing and works under both: quote it. - "NO" is a string to
every parser ever written.
Specifications
- Accepts
- JSON or YAML — type or paste
- Gives you
- .yaml / .json download · copy to clipboard
- Where it runs
- Your browser — the file is never uploaded
- Sign-up
- None
- Cost
- Free, with no usage limits
FAQ
Is my data sent anywhere?
No. Conversion runs on js-yaml inside your browser. Worth caring about here: the YAML developers convert is usually a Kubernetes manifest, a CI config or a docker-compose file, and those carry secrets more often than anyone would like.
Does "no" become false here (the Norway problem)?
Not in this tool. It runs js-yaml 4, which follows the YAML 1.2 core schema where only true and false are booleans — no, yes, on and off all stay strings, and the sample config demonstrates it. But PyYAML and many other loaders default to YAML 1.1, where no does become False. The same file can therefore mean different things in different tools, so quote the value: "NO" is a string to every parser.
Can YAML do things JSON cannot?
Yes, and that is the direction that loses information. Comments, anchors and aliases, multiple documents in one file, and non-string keys all exist in YAML and have no JSON equivalent. Converting YAML to JSON silently drops comments — they are not data, so there is nowhere for them to go.
What happens to very large numbers?
JSON numbers are IEEE 754 doubles, so an integer above 2^53 cannot round-trip exactly. A 19-digit snowflake ID from an API will come back changed. Keep those as strings in both formats.
Which indentation should I use for YAML?
Two spaces is the convention almost everywhere, and what Kubernetes, GitHub Actions and docker-compose examples all use. Tabs are not allowed in YAML at all — a literal tab character is a syntax error, which is a common surprise coming from other formats.
Why did version: 1.10 become 1.1?
It was read as a number rather than a string, and 1.10 and 1.1 are the same number. Version strings, zero-padded codes and anything with a meaningful leading or trailing zero should be quoted. The same applies to 014, which YAML 1.2 reads as fourteen rather than as octal twelve.
Can I convert several YAML documents at once?
A multi-document YAML file separated by --- converts to a JSON array, one element per document. Going back the other way, a JSON array can be written out as separate documents with the multi-document option.