XML to CSV Converter

Input XML

Output CSV

Your CSV appears here as you type.

Paste data to see token savings

Convert XML to CSV with our free online converter.

Example: XML input and real CSV output

The output below was generated by the same conversion code the converter uses, run on this sample when the page was built.

XML input (296 characters)
<catalog>
  <book id="bk101">
    <title>Designing Data-Intensive Applications</title>
    <author>Martin Kleppmann</author>
    <year>2017</year>
  </book>
  <book id="bk102">
    <title>The Pragmatic Programmer</title>
    <author>Andrew Hunt</author>
    <year>1999</year>
  </book>
</catalog>
CSV output

An XML document always has one root element, so it parses to an object rather than an array, and the converter stops with "CSV output requires an array of objects".

Workaround: convert to JSON first (XML to JSON), reshape the data there, then use JSON to CSV.

The same data is 214 characters as minified JSON and 341 as pretty-printed JSON. Sizes are character counts, not tokens: token counts depend on the model's tokenizer (see the tokenizer comparison).

XML to CSV: what changes

  • Reading XML: Attributes are kept with an @_ prefix (id="bk101" becomes "@_id"), repeated child elements become arrays, and numeric text becomes numbers. A single child element becomes an object, not a one-item array, so the shape depends on how many elements appear.
  • Writing CSV: CSV output needs a root-level array of flat objects; anything else fails with "CSV output requires an array of objects". Nested objects are not flattened, so extract or flatten them first.

About XML

Extensible Markup Language is a verbose but powerful format. Still widely used in legacy systems, SOAP APIs, and document formats.

  • ✓Rich metadata
  • ✓Namespaces
  • ✓Validation schemas
  • ✓Legacy support
Full XML Documentation →

About CSV

Comma-Separated Values is the standard format for tabular data. Perfect for spreadsheets, data analysis, and simple data exports.

  • ✓Spreadsheet compatible
  • ✓Simple
  • ✓Universal
  • ✓Great for data analysis
Full CSV Documentation →

Why Convert XML to CSV?

Use CSV when working with spreadsheets (Excel, Google Sheets), doing data analysis, or exporting data for external use.

XML to CSV: Frequently Asked Questions

How do I convert XML to CSV?

Paste your XML into the editor on json2toon.co. The tool detects the input and produces CSV instantly, then you copy the result. Conversion runs entirely in your browser, so nothing is uploaded to a server.

Is the XML to CSV converter free?

Yes. Converting XML to CSV on json2toon.co is free with no account, signup, or usage limit. A free public API is also available for automated, programmatic conversion.

Why convert XML to CSV?

Convert XML to CSV with our free online converter.

What should I watch out for when converting XML to CSV?

An XML document always has one root element, so it parses to an object rather than an array, and the converter stops with "CSV output requires an array of objects".

Is my data safe when I convert XML to CSV?

Yes. The XML to CSV conversion happens client-side in your browser. Your source data stays on your device and is never sent to or stored on a server, which makes it safe for private or sensitive payloads.