UnQTools
File Runs in your browser

XML to JSON Converter

Convert XML to JSON with attribute handling, namespace support, array detection, CDATA preservation, pretty-print, custom attribute prefix and text key. Includes reverse JSON→XML, drag-drop, validation, and history. 100% client-side.

100% Private Works Offline Instant

About XML to JSON Converter

Convert XML to JSON with attribute handling, namespace support, array detection, CDATA preservation, pretty-print, custom attribute prefix and text key. Includes reverse JSON→XML, drag-drop, validation, and history. 100% client-side. Everything runs locally in your browser — your data never leaves your device.

How to use

  1. Enter your input in the tool above.
  2. Adjust any options to your preference.
  3. Use the Copy or Download buttons to save the result.
  4. Everything happens locally — your data never leaves your browser.

FAQ

How does XML-to-JSON conversion work?

Each XML element becomes a JSON object property, each attribute becomes a prefixed key (e.g. id="1" → "@id": "1"), and text content is captured under a configurable #text key. Repeated child elements with the same name are automatically detected and collapsed into JSON arrays.

How are XML namespaces handled?

By default, namespaces are stripped (e.g. <ns:foo> → "foo"). You can toggle namespace preservation, in which case the prefix is kept on the element/attribute name (e.g. "ns:foo"). xmlns declarations can optionally be preserved as regular attributes.

How are arrays detected?

When two or more child elements share the same tag name, they are grouped into a JSON array. A single child stays a single object. This mirrors how most production XML→JSON libraries (fast-xml-parser, xml2js) behave.

What extra features does this tool have?

10 extras: (1) Drag-drop XML file. (2) Paste XML text. (3) Live XML validation. (4) Copy/download JSON output. (5) Reverse JSON→XML conversion. (6) Custom attribute prefix (default @). (7) Custom text key (default #text). (8) Collapse empty elements (omit / null / empty string). (9) Trim whitespace option. (10) History (localStorage — last 10 conversions).

Is my XML data uploaded anywhere?

No. All parsing happens in your browser using pure JavaScript. Your data never leaves your device.

What's the maximum input size?

There's no hard limit, but very large XML (> 10MB) may slow the browser. A depth limit (default 100) prevents stack overflow on deeply nested input.

Search tools and actions

Search across all 170 tools, categories, and quick actions.