Convert to XML

Convert CSV, INI, JSON, NDJSON, TOML, TSV, or YAML to XML. Paste the source or open a local file, then set the element names and formatting. The conversion runs in your browser and does not upload the input.

How conversion works

Link

NDJSON becomes a list under the configured root element. Each line creates one element with the configured array item name. Object keys become child elements, arrays become repeated elements, and scalar values become text. Invalid JSON reports the failing line before XML is written.

JSON objects, TOML tables, and YAML mappings become named child elements. Arrays and sequences become repeated elements with the chosen array item name. Scalar values become text, and null becomes an empty element. A mapping stored under the attributes key, @attributes by default, becomes attributes on its parent element.

CSV and TSV tables become lists of row objects. Dots in a header create nested elements, so hello.there.general becomes three element levels. Columns with the same path are merged into one element tree. A backslash before a dot is also accepted as a separator. Use the first row as headers or supply custom CSV headers. INI sections become elements below the root. INI keys outside a section appear under global, and all INI values remain text.

Source keys must be legal XML names. A key such as first name or 1st produces an error instead of malformed XML. The converter escapes reserved characters such as & and <.

Output options

Link

The root element wraps the complete result. Use a singular array item name such as book or record for lists. Every array uses the same item name, so output with several kinds of list may need manual editing.

Choose spaces or tabs and an indentation width from zero to eight. You can also include or omit the XML declaration. Keep the declaration for a standalone file or when the receiving system expects it.

What XML can represent

Link

XML is a text syntax made from named elements, attributes, and text. Every document has one root element. Names are case-sensitive, opening and closing tags must match, and attribute values must be quoted.

<?xml version="1.0" encoding="UTF-8"?>
<catalogue updated="2026-08-26">
  <book>
    <title>Example</title>
    <available>true</available>
  </book>
</catalogue>

XML can also use namespaces and schemas. Those belong to the receiving system’s vocabulary, so the converter cannot infer them from ordinary source keys. The output is well-formed XML, but it is not checked against an XSD or another schema.

Elements, attributes, and text

Link

Elements can contain text, child elements, or both. Attributes attach name-value pairs to an opening tag. XML does not prescribe whether a simple value belongs in an attribute or child element. The vocabulary used by the receiving system makes that choice. Attributes work for short metadata, while elements can repeat and contain further structure.

XML preserves child-element order. Attribute order has no meaning in the XML data model, even though a serializer must place the attributes somewhere in the text. Whitespace between elements may be formatting or real character data. That distinction is important in document formats with inline markup and is one reason generic data conversion cannot reproduce mixed content reliably.

Escaping, namespaces, and validation

Link

Text writes literal < and & as &lt; and &amp;. XML also defines &gt;, &quot;, and &apos;, plus numeric character references. CDATA sections offer another spelling for text containing markup characters, but parsers return character data either way. This converter escapes text rather than guessing where an author would prefer CDATA.

Namespaces associate names with URI values and prevent collisions between XML vocabularies. A visible prefix is only shorthand. Using the wrong URI creates a different name even if the prefix looks right. Schemas can then define allowed elements, their order, required attributes, and value types. Well-formed XML follows the syntax rules; valid XML also satisfies its schema.

Where XML is used

Link

XML remains common in configuration, publishing, office document formats, feeds, and protocols such as SOAP. Maven POM files, Android resources, SVG, RSS, Atom, and Office Open XML all use fixed vocabularies. Generic conversion can create the underlying tree, but these formats usually require particular root names, namespaces, element orders, and schema rules before an application accepts them.

What may be lost

Link

CSV, INI, JSON, TSV, and YAML do not contain everything that XML can express. The converter does not invent namespaces, CDATA sections, comments, processing instructions, entity declarations, mixed content, schemas, or protocol wrappers such as a SOAP envelope.

XML text has no built-in number, boolean, or null type. The output writes those values as text or empty elements, so converting it back may not restore the original types. YAML comments, anchors, aliases, tags, and scalar styles are also discarded.

Check the required root name, element order, namespaces, and schema before sending the result to an API or import process. Well-formed XML can still be rejected when it does not match that contract. The converter reads the complete input and output into memory, so very large files may slow down the page or exhaust the tab’s memory.

Files, privacy, and saved work

Link

Select a file or drop it on the file control. A recognised extension selects the matching input type. The browser reads the file locally with FileReader and does not upload it.

The selected format, each format’s input, parser settings, and XML output settings are stored in localStorage. Switching formats does not overwrite another format’s text. Clear the fields or site data after handling sensitive information on a shared device.

Link

Widget made with staark