Skip to content
TConverter

XML to JSON Converter

In browserUp to 10 MB

Convert your XML to JSON with attributes preserved. Runs entirely in your browser.

About the XML to JSON converter

The TConverter XML to JSON converter takes an XML document and turns it into clean, indented JSON. XML is still everywhere: SOAP web services, RSS and Atom feeds, sitemaps, office and banking exports, configuration files and older enterprise systems all rely on it. Modern JavaScript code, REST APIs and most data tools, on the other hand, work far more comfortably with JSON. This tool bridges that gap without installing anything.

You can paste XML directly into the text area or select an .xml file of up to 10 MB. A loaded file is placed into the text area, so you can review or edit it before converting. Common use cases include inspecting the structure of a SOAP or feed response, preparing test data for a JavaScript application, migrating legacy XML configuration, or simply reading a deeply nested document more easily.

The conversion follows clear and predictable rules. Attributes are kept rather than discarded: they appear as fields with an @_ prefix, so a book element with the attribute id="1" becomes an object containing "@_id": "1". Attribute values always stay as text, which means a postal code like 01234 keeps its leading zero. Elements that repeat under the same parent become a JSON array, numeric element text is converted to numbers, and when an element contains both text and child elements, its text is placed in a #text field.

Before converting, the input is validated as well-formed XML. If a tag is not closed or the document is broken in some other way, you get an error message that includes the line number instead of a silently incomplete result. Entity expansion is limited, so documents crafted to explode in size are not expanded. Note that this tool converts in one direction only, from XML to JSON. Also, an element that appears once becomes an object while the same element appearing several times becomes an array, so code that consumes the output should handle both shapes.

All processing happens locally in your browser. Your XML file is never uploaded to a server, which makes the tool suitable for internal exports or documents containing customer data. TConverter is free and does not ask you to create an account.

Frequently asked questions

Is the XML to JSON converter free?

Yes. It is completely free and works without registration.

Is my XML file uploaded to a server?

No. The file is read and converted entirely in your browser, so its contents never leave your device.

How are XML attributes represented in JSON?

Attributes are kept as fields with an @_ prefix, for example id="1" becomes "@_id": "1". Attribute values remain strings so that values like leading-zero codes are not altered.

Why is one element an object and another an array?

Repeated elements with the same name under one parent become an array. An element that appears only once is converted to a single object or value, so your code may need to handle both cases.

What is the maximum file size?

You can select XML files up to 10 MB. The whole document is processed in your browser's memory, which is why a limit is applied.

Can I convert JSON back to XML here?

No. This page only converts XML to JSON.