Skip to content
ALL DEVELOPER TOOLS56
JSON FormatterTXT → JSONJSON to CSVJSON → CSVCSV to JSONCSV → JSONSQL FormatterSQL → SQLMarkdown to HTMLMD → HTMLHTML to MarkdownHTML → MDXML FormatterXML → XMLBase64 Encode/DecodeTXT → B64URL Encode/DecodeTXT → URLJWT DecoderJWT → JSONHTML Entity Encode/DecodeTXT → HTMLUUID Generator— → UUIDPassword Generator— → TXTHash GeneratorTXT → HASHLorem Ipsum Generator— → TXTQR Code GeneratorTXT → PNGColor Picker & Converter— → HEXCSS Gradient Generator— → CSSBox Shadow Generator— → CSSRegex TesterTXT → MATCHCron Expression GeneratorTXT → CRONTimestamp ConverterNUM → DATEText DiffTXT → DIFFText Case ConverterTXT → TXTWord CounterTXT → STATSSubtitle ConverterSUBS → SRT · VTT · ASSYAML to JSONYAML → JSONJSON to YAMLJSON → YAMLYAML FormatterYAML → YAMLJSON MinifyJSON → JSONSort & Dedupe LinesTXT → TXTLine Ending ConverterTXT → CRLF · LF · CRXLSX to CSVXLSX → CSVCharset ConverterTEXT → UTF-8HAR ViewerHAR → TABLE · HARJWT EncoderJSON → JWTHMAC GeneratorTXT → MACFile ChecksumFILE → VERDICTWi-Fi QR Code Generator— → QRChmod CalculatorOCTAL → RWXHTTP Status CodesCODE → MEANINGByte ConverterSIZE → UNITSTime Zone ConverterTIME → ZONESAspect Ratio CalculatorSIZE → RATIOURL ParserURL → PARTSExtract ArchiveARCHIVE → FILES · ZIPCreate ZIPFILES → ZIPUnzip FilesZIP → FILESDOCX to MarkdownDOCX → MDSVG OptimizerSVG → SVGBarcode Generator— → BARCODEQR Code ReaderIMG → TEXTVCF to CSVVCF → CSVICS to CSVICS → CSVCSV to Markdown TableCSV → MDBcrypt Generator— → HASH
ENGINE JS-YAMLACCEPTS JSON

JSON to YAML

JS-YAMLTOOL 147 OF 190

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.

ENGINEJS-YAML
ACCEPTSJSON
MAX SIZENONE
UPLOADNEVER
01Drop a .yaml, .yml or .json file into the drop zone, or switch SOURCE to Paste and paste the text in.
02Set DIRECTION to YAML → JSON or JSON → YAML, and pick 2 or 4 spaces under INDENT.
03Read the warnings above the panes — they name every literal the conversion changed — then Copy or Download the output.

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.

Related