JSON to YAML Converter
Paste into either box to convert JSON to YAML or YAML back to JSON. Big numbers stay exact, and every lost detail gets its own warning.
How to Use
- Paste JSON into the top box and the YAML appears below. Paste YAML into the bottom box and the JSON appears above. There's no direction to pick first.
- You can also click “Choose a file” or drop a file (up to 5 MB) into either box. Files ending in .json, .jsonc, or .json5 go into the JSON box and .yaml or .yml files go into the YAML box automatically. Non-UTF-8 files fall back to Windows-1252 on English pages, and you can switch the text encoding manually if anything looks garbled.
- Each box has a “Download” button that saves its text with LF line endings. If you opened a file, the download keeps the base filename with a .json or .yaml extension; pasted text downloads as data.json or data.yaml.
- Choose 2 spaces, 4 spaces, Tab, or Minify for indentation. YAML can't use tabs and has no one-line minified style, so those two options apply only to the JSON side, and YAML always uses 2 spaces.
- Turn on “Sort keys” to order the keys of every object alphabetically while leaving arrays as they are, which makes two configs easier to compare.
- Anything lost or changed during conversion is listed as a warning with the affected path: comments that weren't kept, expanded anchors, extra YAML documents that were skipped, or duplicate JSON keys.
- JSON with comments or trailing commas, such as tsconfig.json, converts too, with a note that lenient mode was used.
- If something is wrong, the box with the problem shows the line and column, quotes that line, and marks the spot with ^. The other box keeps its last good result. “Select the problem” highlights that part for you.
- For TOML, CSV, XML, or other data formats, look for more converters in the Developer Tools category.
- For other pairs, such as YAML to TOML or CSV to XML, use the Data Format Converter: pick any two of JSON, YAML, TOML, INI, .env, properties, CSV, and XML for its two boxes. You'll find it in the related tools below this page.
FAQ
Which file extensions and text encodings are supported, and how are download names chosen?
Files up to 5 MB can be opened in either box. Extensions .json, .jsonc, and .json5 are placed in the JSON box, and .yaml or .yml go into the YAML box; unrecognized extensions stay in the box you chose with a notice. Files are decoded as UTF-8 (with any BOM stripped) first, falling back to Windows-1252 on English pages if invalid, with a menu to re-read as UTF-8, Big5, Shift_JIS, or Windows-1252. Downloads keep your original filename with .json or .yaml, or use data.json / data.yaml when you pasted text.
Why did my comments disappear?
JSON has no comment syntax. YAML does, but comments aren't part of the data and are dropped when the YAML is parsed, so they can't survive a conversion in either direction. The tool warns you when the source has comments, so you can add the important ones back afterwards.
Why don't no, on, and yes in my YAML become true or false?
This tool follows the YAML 1.2 rules, where only true and false are booleans and no, on, and yes are plain strings. Older YAML 1.1 parsers read them as booleans, which is how the country code NO turns into false. When converting JSON to YAML, strings that look like numbers, booleans, or dates are quoted automatically, so even an older parser reads them back with the same type.
Will long numeric IDs get changed?
No. Tools that rely on the browser's built-in JSON parser round integers beyond 2⁵³ (about 9 quadrillion) and long decimals. This tool parses JSON itself and keeps every number exactly as written, so a round trip through YAML doesn't change a single digit. Only lenient mode can't guarantee this for oversized integers, and the tool warns you when that happens.
What happens to YAML anchors (&) and aliases (*)?
Aliases are expanded into the anchored content, because JSON has no equivalent. The result holds the complete data, but converting back to YAML won't rebuild the anchors and aliases, and the tool lets you know when it expands them.
What if my YAML has several documents separated by ---?
Only the first document is converted, and the tool tells you there were more. Kubernetes files often hold several resources in one file. To convert them all, paste each document separately.
Related Tools
Data Format Converter
Pick a data format for each box and convert between any two of JSON, YAML, TOML, INI, .env, properties, CSV, and XML, such as application.properties to YAML, .env to JSON, or CSV to XML. Anything lost along the way is flagged one by one, all in your browser.
JSON to TOML Converter
Paste text or open a file in either box to convert between JSON and TOML (including pyproject.toml and Cargo.toml), with per-path warnings for any lost details.
JSON to CSV Converter
Paste text or open a file in either box to convert between a JSON array and CSV. Nested fields are flattened with a warning, and downloaded CSV gets a BOM so Excel shows non-English text correctly.
JSON to XML Converter
Paste text or open a file in either box to turn legacy XML into JSON or JSON into valid XML with a declaration, with clear rules for attributes, text, and repeated elements.
JSON Formatter
Paste one long line of JSON and get it neatly laid out at once. Pick 2-space, 4-space, or tab indentation, or minify it to one line, sort keys, and check the syntax. Big numbers stay exact, and formatting never changes a value.
Unicode Escape Encoder & Decoder
Type in either box to turn text into \uXXXX, \u{…}, &#x…;, or U+XXXX, or decode any mix of Unicode escapes back into text.
Base64 Encoder & Decoder
Type in either box to encode text as Base64 or decode Base64 back into text. UTF-8 safe, with a URL-safe alphabet option.
URL Encoder & Decoder
Type in either box to percent-encode text for a URL, or decode %20-style sequences back into readable text.
HTML Entity Encoder & Decoder
Type in either box to turn text into HTML entities, or decode < & 中 and other entities back into text. All named entities supported.