How to use it
- Choose an XML file, drop it on the box, or paste XML; the result appears at once.
- Check “Rows from”: the tool picks the largest list of repeated elements. Choose another list if needed.
- Choose the delimiter that your spreadsheet program expects, and keep the UTF-8 BOM if you open the file in Excel.
- Download the .csv file or copy the result.
Rules and limits
XML and JSON mapping
- Each element becomes a key with the element’s name. Namespace prefixes stay part of the name:
soap:Body. - Attributes become keys with an “@” in front:
id="7"becomes"@id": "7". Namespace declarations are kept the same way, as"@xmlns:soap". - An element with only text becomes that text. If it also has attributes or child elements, its text goes under
"#text":<price currency="EUR">12.50</price>becomes{"price": {"@currency": "EUR", "#text": "12.50"}}. - Elements that repeat under the same parent become an array, in document order. Interleaved names are grouped, so the order between different names is not kept.
- CDATA sections become ordinary text. Comments, processing instructions and the DOCTYPE are dropped. Entities defined only in an external DTD, such as
in XHTML, are kept as written, with a note. - An empty element such as
<note/>becomes"". Whitespace between elements is dropped and text is trimmed, except insidexml:space="preserve". - All values stay strings, because XML has no data types:
"00123"keeps its leading zeros.
The array rule: nested data in columns
- Nested objects get dotted column names:
customer.name,customer.address.city. - Arrays get numbered columns starting at 0:
tags.0,tags.1. Arrays of objects combine both:items.0.sku,items.0.qty,items.1.sku. - An empty object or array gives an empty cell under its own column name.
- Columns appear in the order they are first found. A value that a row does not have stays empty.
- Rows come from a top-level array if there is one. Otherwise the largest array of objects is used, for example
orders; you can choose another one under “Rows from”. Without such an array, the whole document is one row. On the XML pages, a document that is only a list of plain values gives one row per value, and a document with a single record gives one row without the root element’s name.
How CSV is written
- Fields that contain the delimiter, a double quote or a line break are put in double quotes; quotes inside are doubled. Rows end with CRLF.
- With the decimal comma, numbers are written as
1,5: JSON numbers and number cells of a workbook. Text is never changed, so XML values stay exactly as written. - The UTF-8 byte order mark (three bytes at the start) makes Excel open the file as UTF-8, so characters such as ü, é or ж display correctly.
Questions and answers
Why are numbers in the CSV not converted?
XML has no data types, so the page cannot know whether 01067 is a number or a postcode. Values are written as they appear; the program that opens the CSV decides.
What if the wrong elements became rows?
Pick another list under “Rows from”. The first guess is the largest list of repeated elements. Elements that repeat inside each record, such as the <item> elements of an order, are not offered as rows: they become numbered columns.
Why are there columns such as item.0.@sku and item.1.@sku?
An element that repeats inside one record gets numbered columns, so that each record stays on one row.
What if Excel shows the whole CSV in one column?
Excel splits CSV files by the list separator of your region settings. Choose the other delimiter, a comma or a semicolon, and download the file again.