YAML ↔ JSON Converter
Convert between YAML and JSON, in either direction. Runs entirely in your browser.
How the conversion works
Choose a direction, paste text or upload a .yaml, .yml or .json file, then press Convert. YAML is parsed with the js-yaml library and written as indented JSON; JSON is parsed with the browser's built-in parser and written as YAML. The result can be copied or downloaded, for example as config-converted.json.
Example
A YAML value marked with an anchor (&name) and reused elsewhere with an alias (*name) is expanded during conversion, so every alias appears as a full copy in the JSON — JSON has no way to point back to an earlier value.
Things that trip people up
Only one YAML document is accepted at a time — a file with several documents separated by --- shows an error, as does empty or comment-only input. A value such as 01234 becomes the number 1234, so quote it ("01234") to keep a leading zero, for example in ZIP codes. Words such as yes, no and on stay text and are not turned into true or false.
Frequently asked questions
Does this preserve comments in YAML?
No — comments and formatting aren't preserved when converting YAML to JSON, since JSON has no concept of comments.