FormatterHQ

XML Converter

Paste XML once and convert it to JSON, YAML, CSV, TSV, an HTML table or readable text with one click per format, using the same mapping rules everywhere.

Input XML
Output JSON
Ready.

How to use the XML Converter

  1. Paste XML into the input editor, upload an .xml file, use Load URL, or click Sample.
  2. Set the Attribute prefix, Detect numbers & booleans and Indent if the defaults do not suit you.
  3. Click To JSON, To YAML, To CSV, To TSV, To HTML or To Text.
  4. Copy or Download the result; for HTML, check the Preview tab.

One XML converter, six output formats

When you receive an XML file and are not yet sure where the data will end up, this XML converter lets you try several targets without re-pasting anything. Every button uses the same parse of your document, so attributes, repeated elements and number detection behave identically across formats. That consistency makes it easy to compare outputs and pick the one that suits the next step.

Choosing a target format

ButtonYou getChoose it when
To JSONThe full document as JSON with @ attributesA script, API or database will consume the data
To YAMLThe full document in block-style YAMLThe data becomes configuration people edit
To CSVThe repeated records as rowsYou need a spreadsheet or bulk import
To TSVThe same rows, tab-separatedYou want to paste straight into spreadsheet cells
To HTMLA table (nested tables for nested data)People should read it on a page or in an email
To TextIndented key: value linesYou need a quick human-readable summary

Example

<catalog>
  <book id="bk101"><title>XML Developer's Guide</title><price>44.95</price></book>
  <book id="bk102"><title>Midnight Rain</title><price>5.95</price></book>
</catalog>

To JSON keeps everything, including the wrapper:

{
  "catalog": {
    "book": [
      { "@id": "bk101", "title": "XML Developer's Guide", "price": 44.95 },
      { "@id": "bk102", "title": "Midnight Rain", "price": 5.95 }
    ]
  }
}

(Condensed; the real output is fully indented.) To CSV keeps only the rows:

@id,title,price
bk101,XML Developer's Guide,44.95
bk102,Midnight Rain,5.95

Shared options

  • Attribute prefix – marks attributes in JSON and YAML keys and in CSV/TSV/HTML column headers. Clear it for plain names.
  • Detect numbers & booleans – makes 44.95 a number and true a boolean in JSON and YAML. Leading-zero values always stay strings.
  • Indent – spacing for JSON output (2, 3, 4 spaces or a tab).

Rules that apply to every format

  • Repeated sibling elements become lists; an element that appears once is a single value. Watch for this when some records have one child and others several.
  • Element text next to attributes is stored under #text.
  • Comments, the XML declaration and processing instructions are ignored.
  • Malformed XML produces an error with line and column for every target, so fix the source once and all outputs work.

A typical workflow

Start with To JSON to see the complete structure the parser produced: which elements became arrays, where #text keys appear and which values were typed as numbers. Then switch to the format your destination needs. If a table looks odd, for example with both sku and sku.0 columns, the JSON view usually explains why: some records contain an element once and others several times. Adjust the source XML or clean up the columns afterwards.

When to use a dedicated page

This hub keeps the most common settings. For more control, go to the single-purpose pages: XML to JSON adds sorted keys, XML to CSV offers delimiters and quoting, and XML to Excel produces a downloadable .xlsx workbook.

Privacy

All conversions run locally in your browser. Load URL fetches through our server, and Save & Share stores the input to create a link; nothing else is sent.

Frequently asked questions

Which format keeps all of my XML data?
JSON and YAML keep the whole document structure. CSV, TSV and HTML flat tables focus on the repeated records, and the text output is meant for reading rather than processing.
Can I convert XML to Excel from this page?
Not directly. Use the XML to Excel converter for an .xlsx download, or click To CSV here and open the file in your spreadsheet app.
Why are some columns named with @?
They come from XML attributes. The Attribute prefix option controls the marker; clear it to use the plain attribute names.
Does the converter validate my XML?
It checks that the XML is well-formed before converting and reports the line and column of any error. It does not validate against a schema.

Last updated September 26, 2026

Related tools