DAP Foundry dap.solutions
convert-yaml-to-json · client-spa · v1 · stub

Convert YAML to JSON

Paste a YAML mapping and get JSON text, entirely in the browser. Runs in this tab. Your inputs stay in this browser.

Input

A YAML mapping of key: value lines, or one value alone. A key with nothing after its colon holds null, or a mapping or a list indented under it with spaces. Blank lines are skipped. Up to 1 MB and 50,000 lines. Anything else is refused as INVALID_YAML, and the error names the line and what was found there.

Output

Pretty JSON with two-space indent and a trailing newline, as JSON.stringify writes it. One value alone is written as that value in JSON, so hello gives "hello" and a line break. true, True and TRUE become true, and false, False and FALSE become false. null, Null, NULL, ~ and an empty value become null. A number becomes a JSON number only when JSON writes it exactly as typed, such as 42, -7 or 1.5. Everything else is text, with the quotes around it removed. Words such as yes, no, on and off, and values such as 12:30, 1_000 or 2026-09-24, stay text, as YAML 1.2 reads them. Spaces (U+0020) around a key, a value or a list item are trimmed, but not inside quotes. Nothing else is trimmed: a no-break space or any other Unicode space stays part of the text, so a no-break space alone gives a JSON string that holds it. In the JSON, a double quote or a backslash in text gets a backslash before it. Every other character is written as it is, not escaped. Keys keep the order of the document, except that keys made only of digits, with no leading zero and below 4,294,967,295, come first in ascending order. Every other key, such as -7 or 1.5, keeps its place.

Limits

How this was made

The core transform was written by hand into the stub registry. There is no model in this factory.

Errors

Every error names the field, the rule, and shows a small valid example. The checks run in this order: empty input, size, line count, then the YAML itself. You see the first one that fails. Input is empty when it holds only spaces (U+0020) and LF or CRLF line breaks, with or without one byte order mark at the start. Any other character, even a no-break space, another Unicode space or a tab, goes on to the other checks.

Inputs not stored

This runs in your browser tab. Your inputs are not uploaded or stored. The tool sets no cookie, uses no local storage and sends no analytics about your inputs.