ALL DEVELOPER TOOLS56
JSON to YAML
JSON to YAML Converter — Free & Instant
Drop a .json file or paste it in, and get YAML — with every number and duplicate key the conversion changes named before you download.
About JSON to YAML
Turning JSON into YAML sounds like the easy direction and is actually the lossy one. The YAML writer takes a JavaScript value rather than text, so the JSON has to be parsed first, and a JSON parse is where a number longer than about sixteen significant digits stops being the number you wrote. 12345678901234567890 comes back as 12345678901234567000, and a decimal point is no protection: 0.1234567890123456789 comes back as 0.12345678901234568, two digits shorter. Alongside that, the trailing zero on 1.0 disappears, 1e2 becomes 100, and a key written twice in the same object loses its earlier value with no error at all. None of that is avoidable on this page, so rather than hiding it, the raw JSON text is scanned before the parse runs and every literal that is about to change is listed with its line, what you wrote, and what it becomes. Read that list before you save the file; if the digits matter, quote them in the source so they arrive as strings. Beyond the numbers the conversion is ordinary. Pick two or four spaces of indent, choose whether long strings wrap into folded block scalars or run on, and take the result by copy or by download. Comments are not carried across, because JSON has none to carry, and the input has to be strict JSON — a trailing comma or a double-slash comment is a parse error, reported with its line and column.
Questions
My user ids came out ending in a run of zeroes.
That is the JSON parse, not the YAML writer. The YAML writer takes a JavaScript value, so the text has to be parsed first, and JavaScript holds every JSON number as a 64-bit float — which stops being able to count exactly at 9007199254740991. A Snowflake id, a Twitter id or a database bigint is longer than that, so it lands on the nearest representable value and the last few digits become zeroes. Every literal this happens to is listed on screen with the value it becomes, before you download anything. The fix is in the source: quote the ids so they arrive as strings.
Why did 1.0 turn into 1, and 1e2 into 100?
Same reason, smaller stakes. Once the text has been parsed into a number, the spelling you used is not stored anywhere — 1.0, 1.00 and 1 are all the same double, and the writer prints the shortest form that reads back as that value. The value a program sees is unchanged, so nothing is broken; the characters in the file are different, so a line-by-line diff against a hand-written original will light up. These are listed separately from the ids that actually changed value, so you can tell the cosmetic ones from the harmful ones at a glance.
One of my keys just vanished from the YAML.
You had it twice in the same object. JSON parsing keeps the last occurrence and discards the earlier value silently — no error, no warning, from any parser. YAML is stricter and rejects a duplicate key outright, which is why this only bites in this direction. The raw JSON text is scanned before the parse for exactly this, and every repeated key is named with the line of the occurrence that won. If both values mattered, the object needed to be an array in the first place.
My long strings got broken across lines with a > sign.
That is a folded block scalar, and it reads back as the same single string — the line breaks are folded into spaces when parsed. It happens because the writer wraps at 80 columns by default. If a tool downstream compares your file line by line, or a human has to read the value, set LONG LINES to 120 or to Never wrap and the string is written on one line however long it is. Nothing about the data changes either way; only where the writer is allowed to break.
It rejects my file and it is definitely JSON.
It has to be strict JSON, which is narrower than what most editors accept. A trailing comma after the last item, a // or /* */ comment, single-quoted strings, unquoted keys and NaN are all JSON5 or JSONC rather than JSON, and the browser's parser refuses every one of them. The error reports the parser's own message with the line and column so you can find the character it stopped on. Strip the comments and trailing commas, or run the file through the JSON Formatter first to find them.
Is my file uploaded to a server?
No. Transmute processes everything locally in your browser using JavaScript and WebAssembly. Your files never leave your device — there is no server, no upload, no cloud processing.