YAML ↔ JSON Converter
Convert YAML to JSON or JSON to YAML as you type. It flags the values YAML 1.1 and 1.2 read differently (NO, 0755, 1:30, 1.10), expands anchors and merge keys, and points to errors by line and column.
How to Use
- Paste YAML or JSON, or drop a .yaml, .yml or .json file. Auto reads text that starts with { or [ as JSON and everything else as YAML; pick YAML → JSON or JSON → YAML to force a direction.
- For YAML input, choose the schema: YAML 1.2 (the current spec, used by most modern parsers) or YAML 1.1 (PyYAML, older tooling), where yes/no/on/off are booleans and 0755 is octal.
- Read the gotchas list: every unquoted value that YAML 1.1 and 1.2 read differently, or whose text changes on the way to JSON, with its line, path and the fix. Click one to select it in your input.
- For a file with several
---documents, keep All to get one JSON array, or pick a single document. - For JSON input, set the indent, string quoting, inline short arrays and key sorting. Leave Quote for YAML 1.1 readers on so values like "NO" and "0755" stay strings everywhere.
- Press Copy or Download, or Use as input to convert the result back and check the round trip.
Worked Example
The same seven lines, two answers. The Norway preset converted with each schema. None of the values is quoted, so each one is typed by the schema’s rules:
| Written | YAML 1.2 (core) → JSON | YAML 1.1 → JSON | Why |
|---|---|---|---|
country: NO | "NO" | false | no is a boolean in 1.1 only |
port: 0755 | 755 | 493 | 1.1 octal: 7×64 + 5×8 + 5 = 493 |
time: 1:30 | "1:30" | 90 | 1.1 base 60: 1×60 + 30 = 90 |
version: 1.10 | 1.1 | 1.1 | a float in both; the trailing 0 is gone |
zip: 01234 | 1234 | 668 | 1.2 drops the zero; 1.1 reads octal 1×512 + 2×64 + 3×8 + 4 = 668 |
enabled: on | "on" | true | on is a boolean in 1.1 only |
release: 2026-10-15 | "2026-10-15" | timestamp 2026-10-15 00:00 UTC | 1.1 has a timestamp type |
Only two of the seven survive both schemas as written, and even those (1.10 and the date) change type or text. Quoting all seven makes every parser return the strings you typed.
Anchors and merge keys. base: &base {restart: always, cpu: 2} followed by api: {<<: *base, cpu: 4} (in block style) converts to {"base":{"restart":"always","cpu":2},"api":{"restart":"always","cpu":4}}. The merge copies both keys, and the key written in api itself wins, so cpu is 4.
The common mistake going the other way: converting {"country": "NO", "version": "1.10", "id": 9007199254740993} with JSON.parse and a plain YAML writer gives country: NO, which a YAML 1.1 reader loads as false, and id: 9007199254740992, because 253 + 1 has no exact 64-bit double. This tool writes country: "NO", version: "1.10" and id: 9007199254740993, then reads its own output back under both schemas to prove nothing changed.
Show Work
Type Rules: How an Unquoted Value Gets Its Type
A quoted or block (|, >) scalar is always a string. A plain (unquoted) scalar is matched against a list of regular expressions, first match wins, and anything that matches none is a string. These are the lists from the YAML 1.2.2 specification (§10.3.2, core schema) and the YAML 1.1 type repository at yaml.org/type.
YAML, JSON and Why Config Files Use YAML
Clark Evans posted the first YAML draft on 11 May 2001 and designed the language with Ingy döt Net and Oren Ben-Kiki. The name first stood for “Yet Another Markup Language”; within a year it became the recursive “YAML Ain’t Markup Language”, to say it is for data rather than documents. YAML 1.0 was published on 29 January 2004 and YAML 1.1 on 18 January 2005.
JSON grew up beside it. Douglas Crockford named and documented the format around 2001, and it is now standardised as RFC 8259 and ECMA-404 (both December 2017). The YAML authors noticed that JSON was, by coincidence, almost a subset of YAML, so YAML 1.2 (21 July 2009) set out to “bring YAML into compliance with JSON as an official subset”. It also dropped most of 1.1’s implicit types: the yes/no/on/off booleans, octal with a bare leading zero, base-60 numbers and timestamps. YAML 1.2.2 (1 October 2021) changed no rules; it corrected errors and clarified the text.
The catch is that many parsers still follow 1.1. Kyrylo Simonov released PyYAML and LibYAML in 2006; PyYAML describes itself as a complete YAML 1.1 parser, and many libraries in other languages are built on LibYAML or modelled on PyYAML, so “YAML” in a given tool can mean either set of rules. That is why the same file can give different data in two programs, and why this converter shows both readings.
YAML won configuration because people edit it: comments, no braces or quotes for most values, multi-line strings, and anchors to avoid repetition. Kubernetes manifests, GitHub Actions workflows, Docker Compose files and Ansible playbooks are all YAML, while the tools behind them often work in JSON internally (kubectl accepts either). JSON stays the format for APIs, where a smaller grammar and one obvious meaning matter more than readability.
About This Tool
This converter turns YAML into JSON and JSON into YAML as you type. It uses the open-source yaml library by Eemeli Aro (ISC licence; Aro also co-wrote RFC 9512, which registers the application/yaml media type), which implements both YAML 1.2 and YAML 1.1. Every unquoted value is also checked against the other version’s rules, so the gotchas list shows exactly which values two parsers would disagree on, rather than a generic warning.
YAML input can hold several --- documents, anchors, aliases, merge keys, tags and comments; errors are reported with line, column, an excerpt and a plain-English cause. JSON input is checked against strict RFC 8259 with its own parser, which keeps key order and integers beyond 253, and the YAML it writes is read back under both schemas as a check. Large files run in a background worker. Nothing you paste or drop is uploaded.
Related tools: JSON Formatter & Validator, JSON Query Tester (JSONPath & jq), and Text Diff Tool.
Frequently Asked Questions
Why did NO turn into false (the Norway problem)?
YAML 1.1 defines 22 spellings of a boolean: y, yes, on, n, no and off as well as true and false, in several capitalisations, so the country code NO is read as false. YAML 1.2 (2009) cut the list to true and false (in three capitalisations), but PyYAML, which describes itself as a complete YAML 1.1 parser, and other 1.1-based tools still do it. Quote the value (country: "NO") and every version keeps the string. Switch this tool to YAML 1.1 to see what those parsers produce.
Is JSON valid YAML?
Almost always. Making YAML a strict superset of JSON was the main goal of YAML 1.2, so any JSON document is also a YAML 1.2 document with the same meaning. The known exceptions are edge cases, such as a key longer than 1,024 characters, which YAML does not allow as an implicit key. Going the other way is lossy: comments, anchors and tags have no JSON form.
What happens to comments, anchors and merge keys?
JSON has no comments, so they are dropped, and the tool tells you how many lines were lost. Aliases (*name) are replaced by a copy of the anchored value, and merge keys (<<: *defaults) are expanded, with keys written in the mapping itself winning over merged ones. Alias bombs (“billion laughs”) are stopped once expansion passes a limit of 10,000, instead of freezing the tab.
Why is my version number 1.10 now 1.1?
An unquoted 1.10 matches the float rule in both YAML 1.1 and 1.2, so it is the number 1.1, and JSON writes it as 1.1. The same happens to Python 3.10 in a CI matrix (it becomes 3.1). Leading zeros go too: 01234 is 1234 in YAML 1.2 and octal 668 in YAML 1.1. Quote versions, ZIP codes, phone numbers and IDs.
How big a file can it convert, and is anything uploaded?
Files up to 20 MB. Anything over about 150 KB is converted in a background worker, so the page stays responsive; a 5 MB YAML file takes about two seconds on a recent laptop. Integers beyond 253 are written with every digit instead of being rounded. Nothing is uploaded: parsing and conversion run in your browser.
How do I use the YAML ↔ JSON Converter?
Just type or paste your value. The answer shows up right away — there is no button to press. Change anything and it updates by itself.
Is it free? Does it work without internet?
Yes to both. It is free with no sign-up, and once the page has loaded it keeps working even with no internet.
Where does my data go?
Nowhere — every calculation runs on your own device. Nothing you enter is uploaded, logged, or stored.
Common Use Cases
Kubernetes manifests
Paste a Deployment and a Service separated by ---: you get a JSON array of 2 objects for jq or kubectl, or pick document 2 alone.
Docker Compose ports
An unquoted 2222:22 is the base-60 number 133,342 to a YAML 1.1 parser; the gotcha list flags it, which is why Docker’s reference says to quote port mappings.
GitHub Actions workflows
The matrix entry python: [3.9, 3.10] becomes 3.9 and 3.1, and a YAML 1.1 parser turns the on: key into true. Both are flagged with the fix.
Config migration
Turn a package.json or appsettings.json into YAML with 2-space indent and sorted keys; strings like "yes", "NO" and "0755" are quoted so no reader retypes them.
Anchors in CI and Compose files
See exactly what <<: *defaults expands to: the merged keys, which local keys override them, and how many aliases were copied.
Debugging a YAML error
A key indented 3 spaces under siblings at 2 is pointed out by line and column, with the excerpt and the reason (“line 4 is read as a continuation of line 3”).
Last updated: