CSV to XML/JSON
Convert one CSV file to both XML and JSON.
CSV to XML and JSON Converter
This CSV to XML/JSON converter is a two-in-one tool for developers who need the same spreadsheet data in both formats — for example a partner that accepts an XML feed while your own front end reads JSON. Load your CSV once, then flip between CSV → XML and CSV → JSON with a single click.
How it works
The input is parsed once with a standards-compliant CSV reader (quoted commas, doubled quotes, and multi-line cells are supported). The selected mode then serialises the parsed rows:
- XML mode writes one row element per record inside a root element, with the columns as child elements or attributes.
- JSON mode writes an array of objects, an array of arrays, an object of column arrays, or an object keyed by the first column.
The table preview below the editors shows exactly which rows and columns were read, whichever mode is active.
Mode-specific options
For XML you can rename the root and row elements, choose attributes instead of child elements, and decide whether to include the XML declaration. For JSON you pick the output shape, whether numbers and booleans are detected, and whether dotted headers like address.city should become nested objects. Indentation, delimiter, and the header switch apply to both.
Practical scenarios
- Publishing a product catalogue as an XML feed for a marketplace and as JSON for your storefront.
- Preparing fixtures for a test suite that exercises both an XML and a JSON endpoint.
- Comparing how the same records look in each format before choosing one for a new integration.
Tips
If header names contain spaces or start with digits, the XML output makes them valid element names while JSON keeps them unchanged. Invalid input, such as an unclosed quote, is reported with its line number in either mode.
Related tools
Need just one format? Use CSV to XML or CSV to JSON. To go from XML to JSON directly, open XML to JSON; to validate the result, use the JSON Validator or XML Validator.
Frequently Asked Questions
Do I have to paste my CSV twice to get both formats?
No. Paste the CSV once and use the CSV → XML / CSV → JSON toggle above the editors. The input stays in place, so you can switch back and forth and copy or download each result in turn.
Why do some options disappear when I switch modes?
Only the settings that apply to the current target are shown. Root and row element names, attributes, and the XML declaration belong to XML; the JSON shape and nesting belong to JSON. The delimiter, header, and indentation settings are shared by both.
Why are numbers typed in JSON but not in XML?
JSON distinguishes numbers, booleans, and strings, so type detection is on by default there. XML text is untyped, so by default each cell is copied exactly as written. You can switch normalization on for XML too, which rewrites values such as 1.50 as 1.5 and TRUE as true.