Your YAML never leaves your browser; nothing you paste is uploaded. The two Send buttons pass the result between pages inside your browser tab only.
YAML to JSON Converter
Convert YAML to JSON in your browser — your YAML never leaves your browser, and nothing you paste is uploaded.
A YAML to JSON converter helps whenever a tool wants JSON and your configuration is YAML: a Kubernetes manifest or Helm values file, a Docker Compose file, a CI workflow or an OpenAPI spec. This page lets you convert YAML to JSON online, free, with no upload: your YAML never leaves your browser. It also shows the choices a parser normally hides, from YAML 1.1 versus 1.2 to how numbers, timestamps and anchors are written.
How do I convert YAML to JSON?
Paste your YAML into the input box or upload a .yaml or .yml file, and the JSON appears on the right as soon as you stop typing. Check the summary above the output, then copy it, download it as converted.json, or send it straight to the JSON Formatter. Nothing is uploaded.
The same steps cover Kubernetes YAML to JSON and Docker Compose YAML to JSON. Several resources separated by three dashes come out as a JSON array.
How to use this YAML to JSON converter
- Add your YAML by pasting it, choosing a file or dropping one on the upload box. Load sample YAML inserts an example.
- Pick the options: YAML version, timestamps, leading-zero numbers, duplicate keys, indent and sorted keys. The messages under the summary line count every value the converter had to decide about.
- Copy, Download as .json, Send to JSON Formatter, or Validate against a schema. Results over about 2 MB show a preview, but all four buttons use the whole result.
- Limits: live updates pause above about 1 MB, so press Convert. Up to 100 levels of nesting are accepted.
Afterwards, the JSON Formatter beautifies the result (its Export menu writes JSON back out as YAML), the JSON Schema Validator checks its shape, and Compare JSON diffs two versions. Other sources have the XML conversion tool and the CSV import tool; the JSON vs YAML guide explains when each format fits, and how to format JSON covers the result.
Why did my YAML value become true or false?
YAML works out a value's type from how it is written. In YAML 1.2, the default here, only true and false are booleans, so NO stays the string NO. In YAML 1.1 mode, yes, no, on, off, y and n also become booleans, which is why NO turns into false. The first gotcha below shows both outputs.
How are anchors, merge keys and multiple documents handled?
Anchors and aliases are resolved: every alias is replaced by a copy of the anchored value, and a merge key copies a mapping into another one, with the keys written locally winning. A file with several documents separated by three dashes becomes a JSON array with one item per document, and the page says how many it found.
Because aliases are copies, a small file can describe a huge result, so the converter measures the JSON size first and stops with Output too large above about 20 MB. A recursive alias cannot be written as JSON and shows an error.
Worked example: anchor, merge key and multi-line string
Both blocks were copied from this converter. Development and production pull in the shared defaults with a merge key; production overrides the host and adds a banner written as a literal block, which keeps its final newline. In the JSON output that banner is one string with \n escapes; paste it into the JSON escape and unescape page to read it as plain lines again.
YAML input
defaults: &defaults
adapter: postgres
host: db.internal
pool: 5
development:
<<: *defaults
database: app_dev
production:
<<: *defaults
database: app_prod
host: db.prod.internal
banner: |
Deploys run Fridays only.
Ask in #ops first.
JSON output
{
"defaults": {
"adapter": "postgres",
"host": "db.internal",
"pool": 5
},
"development": {
"adapter": "postgres",
"host": "db.internal",
"pool": 5,
"database": "app_dev"
},
"production": {
"adapter": "postgres",
"host": "db.prod.internal",
"pool": 5,
"database": "app_prod",
"banner": "Deploys run Fridays only.\nAsk in #ops first.\n"
}
}
YAML gotchas
1. The Norway problem
YAML 1.1 turned yes, no, on, off, y and n into booleans, so the country code NO became false. The default 1.2 mode keeps them as strings; use 1.1 only for tools that still follow the older rules. The rules cover keys too: a GitHub Actions on: key becomes "true".
YAML input
country: NO flag: yes status: on answers: [y, n]
JSON output, YAML 1.2 (default)
{
"country": "NO",
"flag": "yes",
"status": "on",
"answers": [
"y",
"n"
]
}
JSON output, YAML 1.1 mode
{
"country": false,
"flag": true,
"status": true,
"answers": [
true,
false
]
}
GitHub Actions YAML input
name: CI
on:
push:
branches: [main]
JSON output, YAML 1.1 mode
{
"name": "CI",
"true": {
"push": {
"branches": [
"main"
]
}
}
}
2. Leading zeros, octal and hex
A number with a leading zero stays a string by default, because turning 00501 into 501 loses data (YAML 1.2 reads 007 as 7; untick the option for numbers). 0x1F and 0o755 become decimal with a notice; 0b101 and 1_000 stay strings. In 1.1 mode a leading zero means octal.
YAML input
zip: 00501 build: 007 mask: 0x1F perm: 0o755 bits: 0b101 big: 1_000
JSON output, YAML 1.2 (default)
{
"zip": "00501",
"build": "007",
"mask": 31,
"perm": 493,
"bits": "0b101",
"big": "1_000"
}
YAML input, 1.1 mode
zip: 00501 perm: 0755 bits: 0b101 big: 1_000
JSON output, YAML 1.1 mode
{
"zip": 321,
"perm": 493,
"bits": 5,
"big": 1000
}
3. Big integers
Integers beyond 2^53 are kept as strings, with a notice, because anything reading JSON with JSON.parse, such as the formatter and validator, would round them silently.
YAML input
id: 12345678901234567890 limit: 9007199254740991 next: 9007199254740993
JSON output
{
"id": "12345678901234567890",
"limit": 9007199254740991,
"next": "9007199254740993"
}
4. Timestamps
By default a timestamp stays exactly as written. Convert to ISO string keeps a date-only value as a date, keeps an offset, and gives a value with no zone a Z and a notice, as YAML treats it as UTC. No Date object is built, so a date never gains a time.
YAML input
date: 2026-10-01 at: 2026-10-01T08:30:00+02:00 local: 2026-10-01 08:30:00
JSON output, default
{
"date": "2026-10-01",
"at": "2026-10-01T08:30:00+02:00",
"local": "2026-10-01 08:30:00"
}
JSON output, ISO strings
{
"date": "2026-10-01",
"at": "2026-10-01T08:30:00+02:00",
"local": "2026-10-01T08:30:00Z"
}
5. Anchors, merge keys and recursion
Merge keys work in both versions and must point to a mapping or a list of mappings, or the line and column are reported. A billion-laughs file, where nested aliases multiply, is refused in well under a second.
6. Several documents in one file
Documents separated by three dashes become a JSON array. A trailing three dashes is ignored, an explicit null document stays, and comment-only input shows No YAML document found.
YAML input
--- name: web port: 8080 --- name: worker port: 9090
JSON output
[
{
"name": "web",
"port": 8080
},
{
"name": "worker",
"port": 9090
}
]
7. Non-string keys and key order
JSON keys are strings, so 1, true and null become "1", "true" and "null". JavaScript puts integer-like keys first, whatever the YAML order; Sort keys orders by character code, so "10" comes before "2". A list or mapping used as a key gives: Complex (non-scalar) keys cannot be written as JSON keys. (line 1, column 1)
YAML input
10: ten 2: two name: n 1: one true: yes_value null: nothing
JSON output
{
"1": "one",
"2": "two",
"10": "ten",
"name": "n",
"true": "yes_value",
"null": "nothing"
}
8. Tabs and indentation errors
YAML forbids tabs for indentation: YAML does not allow tabs for indentation. (line 2, column 1) An unquoted colon followed by a space inside a value gives Bad indentation of a mapping entry. (line 1, column 15) Quote the value.
9. YAML 1.1 versus 1.2
1.2 is the newer version and the default. 1.1 mode applies the older rules for booleans, octal and binary numbers, underscores and timestamps, and reads !!binary as base64 text, !!set as an object with null values, !!omap as a list of single-key objects and !!pairs as pairs. In 1.2 mode those tags and custom tags give an error naming the tag; this tool never builds custom types or runs code.
10. YAML exported by this site
Export as YAML in the JSON Formatter double-quotes any string a parser could read as another type, plus empty and multi-line strings, and writes empty lists and objects as [] and {}. In a test of 1,551 documents, all 6,204 reads in YAML 1.2 and 1.1 mode matched the original JSON, except integers beyond 2^53 (kept as text) and -0 (becomes 0).
Frequently Asked Questions
How do I convert YAML to JSON?
Paste your YAML or upload a .yaml or .yml file, keep the default options, and the JSON appears in the output box. Then copy it, download it as a .json file, or send it to the JSON Formatter. Nothing is uploaded.
Is YAML a superset of JSON?
Mostly yes. YAML 1.2 was written so that valid JSON is also valid YAML, which is why you can paste JSON into this converter. YAML adds comments, anchors and multiple documents that JSON cannot represent.
Why did my YAML value become true, false or a number?
In YAML 1.1 mode the words yes, no, on, off, y and n become booleans, so NO turns into false; in the default 1.2 mode only true and false do. Numbers such as 0x1F convert to decimal, leading-zero numbers and integers beyond 2^53 stay strings.
How are anchors and multiple YAML documents handled?
Anchors, aliases and merge keys are resolved into plain copies. A file with several documents separated by three dashes becomes a JSON array with one item per document, and the page says how many it found. A recursive alias cannot be written as JSON and shows an error.
Is my data uploaded?
No. Conversion runs in your browser, and your YAML never leaves your browser. Nothing you paste or upload is sent to a server.
Built and maintained by Deepak Kumar. Your YAML never leaves your browser, and nothing you paste is uploaded.