XML to YAML
Convert XML to YAML. Paste XML on the left; the YAML output builds on the right as you type.
<order id="1042">
<status>shipped</status>
<items>pen</items>
<items>notebook</items>
</order>
becomes
order:
"@_id": "1042"
status: shipped
items:
- pen
- notebook
The id attribute becomes a quoted "@_id" key, since a bare @ at the start of a YAML key has special meaning in some YAML processors and this converter quotes it defensively. The two <items> elements collapse into one items list, with pen and notebook as entries.
Strings, not numbers
XML has no type system beyond text, so <count>3</count> produces the string "3" in the YAML output, not the bare number 3. If you need real YAML numbers, convert through JSON first and adjust the field there, or accept the quoted string if your downstream YAML parser coerces it anyway.
Quoting choices
The YAML serializer quotes a value only when leaving it bare would change its meaning, such as a string that looks like a number, or contains a colon followed by a space. Most plain element text ends up unquoted; attribute-derived keys like @_id are quoted because of the leading @, not because of their value.
When to use this over XML to JSON
Pick this pair when the destination is a YAML config file or a CI pipeline definition that expects YAML directly. If you’re feeding a script that calls JSON.parse or an API that expects a JSON body, use XML to JSON instead; both start from the same parsed XML.