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.

Indent
Indent

How to Use

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. JSON with comments or trailing commas, such as tsconfig.json, converts too, with a note that lenient mode was used.
  8. 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.
  9. For TOML, CSV, XML, or other data formats, look for more converters in the Developer Tools category.
  10. 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.