Developer Tools

XML to JSON Converter

Convert between XML and JSON formats online for free — attributes, nested elements, and repeated tags all map cleanly, instantly inside your browser.

Private by default Instant results No signup
XML ⇄ JSON ConverterLive
Overview

What does this converter do?

XML and JSON both represent structured, nested data, but a lot of older APIs, config formats, and enterprise systems still speak XML while most modern tooling expects JSON. This converter moves data between the two directly in the browser — turning an XML document into an equivalent JSON object, or building well-formed XML back out of a JSON object.

It uses the browser's own XML parser to read XML accurately, and follows a predictable, widely-used convention for representing XML attributes and text content in JSON, so the structure stays recognizable in either direction.

Guide

How to use it

1Choose a direction: XML → JSON or JSON → XML
2Paste or upload your data
3Set a root element name if converting from JSON
4Copy or save the converted result

How attributes and text are represented

XML attributes become JSON keys prefixed with @ — an id attribute on an element becomes "@id" in the resulting object. An element's own text content is stored under a "#text" key whenever that element also has attributes or child elements; if an element contains only text and nothing else, it converts directly to a plain string value. Sibling elements that share the same tag name become a JSON array automatically, so repeated <item> elements turn into a list rather than overwriting each other.

Why it helps

Features & benefits

Converts in either direction from the same input box
Uses the browser's native XML parser for accurate parsing
Handles attributes, nested elements, and repeated tags
Custom root element name when converting JSON to XML
100% private — nothing leaves the device

Why this runs entirely in your browser

XML and JSON payloads often carry real system or business data, so nothing is uploaded. Parsing and conversion run locally in the tab using the browser's built-in XML parser and JavaScript's native JSON handling, which means it keeps working offline once the page has loaded and nothing pasted or uploaded into it persists after the tab is closed.

Common uses

Converting a legacy XML API response into JSON for a modern frontend, turning a JSON config into XML for a system that only accepts that format, inspecting a SOAP or RSS payload as more readable JSON, or round-tripping structured data between two tools that each expect a different format.

Frequently asked questions

A few things people usually want to know before trusting the numbers.

Each attribute becomes a JSON key prefixed with @ — for example, an id attribute becomes "@id" in the resulting object.

When converting JSON to XML, it sets the name of the outermost XML tag — used whenever the JSON doesn't have a single top-level key to infer that name from.

Sibling elements with the same tag name are automatically collected into a JSON array, so repeated elements like <item> don't overwrite one another.

Yes. Use the upload button to load an .xml or .json file directly, depending on the selected conversion direction.

No. All conversion happens locally in your browser. Nothing typed, pasted, or uploaded here is sent to a server, stored, or shared.