YAML to JSON Converter
Convert YAML to JSON and JSON to YAML in your browser. Handles anchors, multiple documents and CloudFormation tags, and keeps big numbers exact.
Valid YAML, converted to JSON.
Runs in your browser. Nothing you enter is uploaded.
How to use
This tool converts YAML to JSON and JSON back to YAML as you type, and checks that the input is valid.
- Paste YAML into the box, or Open a file. Open the JSON to YAML tab to go the other way; opening a .json file goes there itself. Switching tabs carries the result over, so a round trip takes two clicks.
- The converted text appears next to it. Copy it, or Download it as a .json or .yaml file.
- If the input has a mistake, the tool says what is wrong and where. Click the line and column to jump to it.
What the YAML to JSON side handles:
- Comments are left out, as JSON has no place for them.
- Anchors (
&name), aliases (*name) and merge keys (<<: *name) are expanded. - Several documents separated by
---become one JSON array, or you can keep only the first. - Keys stay in the order you wrote them, even ones that look like numbers, such as
404or2024. - Dates stay exactly as written, as text.
- Whole numbers too long for JavaScript, like large IDs, keep every digit.
- CloudFormation short forms like
!Refand!Subbecome their full JSON form. Other custom tags are left out and their values kept.
When writing YAML, strings that older YAML readers could take for something else, like yes, no or 2026-10-12, are quoted. Choose 2 or 4 spaces of indentation. Keys keep their order, or sort them if you like.
Frequently asked questions
Is all JSON valid YAML?
Almost. YAML 1.2 was designed so that JSON documents are also valid YAML, so you can usually paste JSON into a YAML file as it is. Converting it to proper YAML makes it shorter and easier to read.
Why were my comments removed?
JSON has no comments, so they can't be carried over. Converting the JSON back to YAML won't bring them back, so keep your original file.
Why is yes written as 'yes' with quotes?
Older YAML readers, which follow YAML 1.1, read yes, no, on and off as true or false. Quoting them keeps them as text in every YAML reader.
Related tools
- JSON formatter Format, validate and minify JSON in your browser, see it as a tree with paths, and fix JavaScript-style JSON.
- JSON to CSV converter Convert JSON to CSV for Excel or Google Sheets, and CSV back to JSON.
- Base64 encoder Encode text or files to Base64 and decode Base64 back to text or a file.