Skip to content
AtlasDocs
Blog

How to convert JSON to YAML, YAML to JSON and XML to JSON

Published on August 06, 2026

Converting JSON to YAML, YAML to JSON or XML to JSON takes one click, for free, in your browser. Here are the three paths, what is preserved and what AtlasDocs won't do.

How to convert JSON, YAML and XML

This guide covers three AtlasDocs converters: JSON to YAML, YAML to JSON and XML to JSON. You upload the file, click "Convert and download" and get the result with the same name and the new extension. None of them produces XML; to go from XML to YAML, convert to JSON first and then to YAML. Everything runs in your browser, with nothing to install.

  1. Pick the tool for the path you need: "Convert JSON to YAML", "Convert YAML to JSON" or "Convert XML to JSON".
  2. Upload the file (.json, .yaml or .yml, or .xml). You can upload several at once; you get one result per file.
  3. Click "Convert and download". The generated file keeps the same name with the new extension (.yaml or .json).
  4. Need XML as YAML? Convert the XML to JSON, then send that JSON to the YAML conversion.
Convert JSON to YAML

What each conversion preserves

  • JSON to YAML: keeps key order, types and large integers exact (an 18-digit ID is not rounded). The output uses block style, with indentation instead of braces and brackets. Text that an older YAML reader would mistake for something else, such as "yes", "no", "on", "off", an empty string or anything that looks like a number, is quoted automatically.
  • YAML to JSON: reads by the current standard, [YAML 1.2](https://yaml.org/spec/1.2.2/), where only true and false become booleans and dates stay text. It resolves anchors and aliases (& and *) and the merge keys (<<) used in Docker Compose. Several documents separated by --- become a list. Comments don't survive, because JSON has no comments.
  • XML to JSON: each element becomes an object; attributes become keys prefixed with @ (@id, for example); text that sits next to attributes or child elements goes into the #text key; sibling tags with the same name become a list. All values stay text: <price>10</price> becomes "10", not 10, so leading zeros are never lost. The root tag's name becomes the top-level key of the JSON.

What the tool does not do

  • It does not produce XML from JSON or YAML. XML only comes in as a source.
  • It does not convert XML to YAML in one step: it takes two (XML to JSON, then JSON to YAML).
  • It does not repair broken files. Malformed JSON, YAML with wrong indentation or XML with a missing closing tag is refused with an on-screen notice instead of producing a half-finished result. Check the source file in an editor and try again.
  • It does not convert YAML's infinite or undefined numbers (.inf and .nan), because JSON cannot represent them: the tool warns you instead of silently writing null.
  • It has no options: one button per converter. You cannot choose indentation or quoting.

Need the reverse path? The YAML to JSON conversion is the way to bring a configuration file into your code or an API.

Convert YAML to JSON

Received XML from a legacy system, an electronic invoice or a feed? The XML to JSON conversion gives you a readable structure, ready for your program.

Convert XML to JSON

JSON, YAML or XML: when each format is required

All three store the same thing: tree-shaped data with objects, lists and key-value pairs. JSON is compact and became the standard for APIs. YAML swaps braces and brackets for indentation and dominates configuration files for Docker Compose, Kubernetes, GitHub Actions and Ansible. XML is the oldest and most verbose, with opening and closing tags and attributes, and still rules corporate integrations, SOAP, electronic invoices and legacy systems. The choice depends on who will read it and which tool asks for it. If your data is a table, in CSV or Excel, the guide is a different one: how to convert CSV, JSON and Excel to each other.

Common mistakes when converting

  • "yes" turned into true in another program: older YAML readers (the 1.1 standard) treat yes, no, on and off as booleans. When generating YAML, AtlasDocs already quotes those strings; if you edit the file later, keep the quotes.
  • Large number rounded: that happens in careless converters. Here large integers come out exact, both from JSON to YAML and from YAML to JSON.
  • Key order changed: it doesn't. The YAML conversion keeps the original order, which helps compare versions in source control.
  • XML structure not what you expected: remember the convention. Attributes get @, mixed text goes to #text and repeated tags become a list; a tag that appears only once stays an object, not a one-item list.

Want to hand a JSON or YAML file to someone who won't open a code editor? The JSON/YAML to a professional PDF tool produces a tidy PDF as a table, chart, tree or code, depending on the data. See how to convert JSON or YAML to PDF.

Convert JSON or YAML to PDF

Everything happens in your browser: the file is processed on your own device and is never sent to any server. Your data never leaves your computer.