Dad’s Data formats tools

XML → YAML Converter

Convert XML to YAML via JSON. Attributes are flattened; namespace prefixes are dropped.

XML Input
YAML Output

YAML output will appear here.

Paste, upload, or drop a file in the input panel to get started.

How the conversion works

XML is converted to YAML via two steps: XML → JSON (using the XML parser), then JSON → YAML. The XML parser flattens element content and attributes into a JSON object, which is then serialised as YAML. Namespace prefixes are dropped during parsing.

Input
<?xml version="1.0"?>
<server>
  <name>api-prod</name>
  <port>8080</port>
  <features>
    <item>auth</item>
    <item>logging</item>
  </features>
</server>
Output
server:
  name: api-prod
  port: '8080'
  features:
    item:
      - auth
      - logging

Attribute and namespace handling

XML constructYAML outputNotes
Element text contentString valueUnder the element key
AttributeFlattened to sibling keyMerged with child elements
Namespace prefix (ns:x)Key without prefix (x)Prefix dropped
Default namespaceNo key modificationIgnored in output
CDATA sectionPlain stringMarkup stripped
Processing instruction(dropped)Not in JSON/YAML data model
XML comment(dropped)No YAML equivalent
Repeated elementsYAML sequenceSame-name siblings → array
Note: XML attributes and child elements share the same key namespace in the JSON intermediate representation. If an attribute and a child element have the same name, the child element value wins (it overwrites the attribute).

Handling mixed content

XML supports mixed content — elements that contain both text and child elements. This has no direct equivalent in YAML. The converter places the text content under a #text key alongside child element keys. If there are no child elements, text content becomes the direct string value.

Input
<description>A <strong>bold</strong> statement</description>
Output
description:
  '#text': A  statement
  strong: bold

Frequently Asked Questions

Your files stay on your computer. Dad promised.

Data formats tools

Search the Data formats tools