Kubernetes manifest on the left, a JSON schema validator that only takes JSON on the right. A YAML to JSON converter closes that gap. Paste the YAML, read the JSON, copy it. The same page converts JSON to YAML when you need a readable config file from an API response.
What the YAML to JSON conversion does with your file
The tool reads YAML 1.2. In that version yes, no, on and off are plain strings, not booleans. A date such as 2001-12-14 stays a string. An octal number needs the prefix 0o, so 0o17 is 15 and 017 is 17.
Anchors (&name), aliases (*name) and merge keys (<<: *name) are resolved, so the JSON contains the copied values. Comments do not exist in JSON and are dropped.
A file with several documents separated by --- becomes a JSON array with one entry per document. The stats line says how many it found, for example "3 documents". A file with one document stays a plain object or list. Empty documents at the end are ignored.
Converting a config in four steps
- Choose the direction with the buttons "YAML → JSON" or "JSON → YAML". The box shows a sample for each direction until you type your own.
- Paste your text. The conversion starts 300 milliseconds after your last keystroke. The first run loads the YAML library, so it can take a moment.
- Set the options: JSON indent of 2 spaces, 4 spaces or minified, and "Sort keys alphabetically". For YAML output you can also pick the indent and fold long lines at 80 characters or not at all.
- Press "Copy" or "Download". The download is named
converted.jsonorconverted.yaml.
Strings that look like numbers, booleans or null
JSON to YAML has one trap: the string "123" must not turn into the number 123. The tool writes it with quotes. The same holds for "null", "true", "~" and an empty string. It also quotes "yes", "no", "on", "off" and anything that starts like a date, because YAML 1.1 parsers read them as booleans or timestamps. Strings with line breaks become block scalars with |.
Errors, warnings and values JSON cannot hold
A broken YAML file stops with the library message and the line and column, for example a tab used as indentation. Two equal keys in one map are an error, not a silent overwrite. An alias without an anchor above it is an error too. An unknown tag such as !custom is only a note, and the value is kept as text.
YAML allows .nan, .inf and -.inf. JSON does not. The tool writes null for them and tells you how many it replaced. Integers beyond 2^53 (about 9 quadrillion) are rounded to the nearest number JavaScript can store, with a note. The same rounding happens when you paste JSON with such numbers. If a JSON text repeats a key, the last value wins.
Input above 2,000,000 characters is refused with a message.
What leaves your machine
Nothing is uploaded. The YAML library is a script of this site that your browser loads once, when you convert for the first time. After that, parsing and writing run in your browser tab. "Copy" uses the clipboard, "Download" saves a file from the browser. You can watch the network panel while you convert: there is no request with your text.