XML Converter

Pick a target format and turn one XML document into JSON, YAML, CSV, TSV, an HTML table, SQL insert statements or a flat path list.

XML
Result
Runs locally in your browser

About the XML Converter

Most XML jobs end with the same question: what shape does this need to be in next? Rather than hopping between six single-purpose pages, this converter keeps your document in the left pane and swaps only the output. The parse happens once with the browser XML engine, then the same in-memory tree feeds every target, so a document that converts cleanly to JSON will also convert cleanly to YAML or CSV.

The tabular targets (CSV, TSV, HTML table and SQL) look for the first repeating list of records inside the document and flatten each record with dotted keys, so total plus its currency attribute become two columns. The tree targets (JSON, YAML and the path list) keep the full hierarchy instead. Attributes are given the prefix you type in the toolbar so they never collide with a child element of the same name, and repeated sibling elements become arrays.

SQL output writes one INSERT per record against the table name you supply, quoting identifiers and escaping single quotes by doubling them. When you only need one direction and want the extra switches that come with it, the dedicated pages are still there: XML to JSON, XML to YAML and XML to CSV.

How to use

  1. Paste your XML on the left or upload an .xml file.
  2. Choose a target in the Convert to menu. The right pane updates immediately.
  3. Adjust the attribute prefix, indent or SQL table name if the default does not suit your data.
  4. Copy the result or download it with the matching file extension.

Common questions

Which formats can this page produce?
JSON, YAML, CSV, TSV, an HTML table, SQL INSERT statements and a flat list of element paths.
Why is my CSV output only one row?
The tabular targets need a repeating element to act as the record. If your document has a single record, one row is correct; wrap several records in a common parent to get more.
Does the SQL output create the table?
No, it emits INSERT statements only. Create the table first with column types that match your data.
Are XML comments kept?
No target format has a comment concept that maps cleanly, so comments are dropped during conversion.