YAML to JSON converter
The result appears here.
Convert
Your document never leaves the browser.
YAML to JSON, read as YAML 1.2 — anchors and merge keys expanded, never uploaded.
Paste or drop a YAML file and get JSON back, with every value meaning what the YAML said — and a note for anything JSON cannot keep.
The reader follows the YAML 1.2 core schema. Only true and false (in lower, title or upper case) are booleans; null, Null, NULL, ~ and an empty value are null. So yes, no, on, off, y and n stay strings, and the country code NO is still NO — the “Norway problem” of YAML 1.1 does not happen here. Hexadecimal 0x and octal 0o integers are written as decimal without losing a digit.
The YAML
country: no
enabled: yes
verified: true
retries: ~
port: 0x1F90The JSON it gives, at the default settings
{
"country": "no",
"enabled": "yes",
"verified": true,
"retries": null,
"port": 8080
}A compose file with an anchor and a merge key
x-base: &base
restart: always
web:
<<: *base
image: nginxThe JSON it gives, and the notices under it
{
"x-base": {
"restart": "always"
},
"web": {
"restart": "always",
"image": "nginx"
}
}Converts
Block and flow mappings and sequences, all five scalar styles, and literal and folded blocks with their chomping indicators.
Converts
Anchors and aliases are expanded into copies, because JSON has no references; the result counts them.
Converts
Merge keys (<<), the YAML 1.1 feature docker-compose and GitLab CI rely on, are expanded, with a notice saying so.
Converts
Several documents in one stream become a JSON array of documents, and the notice says how many.
Converts
Comments are dropped and counted. Tags such as !Ref or !!binary keep their untagged value and are listed. Keys that are not strings, like 1: or true:, are written as strings from their source text.
Some YAML has no honest JSON equivalent, and the page says where rather than writing something close: a key that is itself a mapping or sequence, an alias to an anchor that contains it, an alias to an anchor that does not exist, a key repeated in one mapping, .inf and .nan as values, and tabs used for indentation. The error names the line and column and marks them in the source.
A key repeated in one mapping
name: web
port: 80
name: api✕ Line 3, column 1: Duplicate key "name" — YAML 1.2 forbids it
The conversion runs in your browser, in the same engine the editor uses. The document is never uploaded, never logged and never leaves your machine — there is no server to send it to. Once the page has loaded it keeps working with the connection off.
Going the other way?
No. A number is copied into the JSON as it was written, so an 18- or 20-digit identifier survives. Nothing on the way passes through a JavaScript number.
Not in JSON, which has no comments. The result counts how many were dropped, so you know before you replace the file.
At the indent in Settings ⚙ — 2, 3 or 4 spaces, or a tab.