YAML → XML Converter
Convert YAML to XML via JSON. Comments will be stripped; arrays become repeated elements.
How the conversion works
YAML is converted to XML in two steps: YAML → JSON (using the YAML parser), then JSON → XML (using the XML serialiser). The intermediate JSON step means that YAML comments are always stripped — they have no equivalent in JSON or XML.
Input
# Server config name: api-server port: 8080 features: - auth - logging
Output
<?xml version="1.0" encoding="UTF-8"?> <root> <name>api-server</name> <port>8080</port> <features>auth</features> <features>logging</features> </root>
Type and structure mapping
| YAML value | XML output | Notes |
|---|---|---|
| String | <key>value</key> | Always text content |
| Integer / Float | <key>42</key> | Numbers serialised as text |
| Boolean true | <key>true</key> | Lowercase string |
| Boolean false | <key>false</key> | Lowercase string |
| null / ~ | <key/> | Self-closing element |
| Sequence | <key>…</key> × N | One element per item, tag repeated |
| Mapping | Nested child elements | Keys become child tag names |
| Comment | (stripped) | No XML equivalent |
Warning: YAML keys must be valid XML element names. Names that start with a digit, contain spaces, or use reserved characters like
< / > will cause the XML output to be malformed. Rename those keys before converting.Array handling
XML has no native array type. YAML sequences become repeated sibling elements with the same tag name — the most common XML convention for lists. This is compatible with most XML parsers and XSLT stylesheets.
Input
tags: - typescript - react - bun
Output
<tags>typescript</tags> <tags>react</tags> <tags>bun</tags>
Frequently Asked Questions
Your files stay on your computer. Dad promised.