XML · LIVE

XML ↔ JSON Converter

Convert XML to JSON and JSON to XML instantly in your browser. Handles attributes, nested elements, and arrays.

Settings

XML Input

Waiting for input

JSON Output

Output appears here

Try an example

What is XML to JSON conversion?

XML (eXtensible Markup Language) and JSON (JavaScript Object Notation) are both data interchange formats, but JSON has become the dominant choice for modern APIs and web applications due to its simplicity and native JavaScript support. Converting XML to JSON is a common task when working with legacy APIs, SOAP services, RSS feeds, or configuration files.

How does the conversion work?

This tool uses the browser's native DOMParser to parse XML, then walks the DOM tree to produce a JSON representation. Element attributes are preserved as @attr keys, text content becomes a #text key (or a direct string value in compact mode), and repeated sibling elements with the same tag name become JSON arrays.

How are XML attributes handled?

When "Include attributes" is enabled, XML attributes are represented as keys prefixed with @. For example, <user id="1"> becomes {"@id": "1", ...}.

What does "Compact text nodes" do?

In compact mode, elements with only text content (no child elements) are represented as a plain string value instead of {"#text": "value"}. This produces cleaner JSON for simple XML structures.

Is my XML data uploaded to a server?

No. All processing uses the browser's built-in XML parser. Your data never leaves your device.

Can it handle large XML files?

Yes. The browser's native DOMParser handles large documents efficiently. Performance depends on your device's memory and CPU.