FreeConvert1PDF, document and archive tools
Tool index A–Z

XML to JSON

Banks, tax portals, e-invoicing networks and older business software still exchange data as XML. When you need that data in JSON, for a spreadsheet add-on, a low-code tool or a script, convert the file here. It is parsed by the XML engine built into your browser.

Choose files
or drop them here
XML · folders work too
Processed on your device: your files are never uploaded.No sign-upNo watermarkNo daily limitNo queue

How to convert XML to JSON

  1. Pick the XML file, or several of them.
  2. Leave number conversion off to keep every value exactly as text, or switch it on for numeric fields.
  3. Convert and download the JSON.

How the XML is translated

The outermost element becomes the top key of the JSON. Elements holding only text become simple values. Attributes such as currency="EUR" appear as "@currency", and where an element has both attributes and text, the text sits under "#text".

Elements that repeat inside the same parent, like several <Invoice> or <Line> entries, are gathered into a list in their original order. A child that occurs only once stays a single value, so a file with one invoice line and a file with ten will look slightly different.

Namespaces, CDATA and comments

Prefixed names used by standards such as UBL or ISO 20022 are kept as they are, for example "cbc:ID", and the xmlns declarations stay as attributes. Text inside CDATA sections is treated like any other text, and spaces around values are trimmed.

Comments and processing instructions are left out. Mixed text and markup in one element, typical of formatted documents rather than data exports, is flattened, so the word order inside such paragraphs is not kept.

Broken files and privacy

If the XML is not well-formed, for example a tag left open or a bare & in a company name, the error states the line and column. The browser parser never downloads external DTDs or entity files.

Because the conversion runs in the tab, invoices, statements and personal records in the XML are not uploaded anywhere.

Questions

Will leading zeros in account numbers survive?

Yes. Values stay text by default, and even with number conversion on, anything with a leading zero is left alone.

Can I go back to XML later?

Yes, JSON to XML understands the same @ and #text markers.