XML to JSON

Convert XML data into JSON format.

Input data is processed in your browser
Data is never sent to a server

Tool

0 chars

What is XML to JSON?

XML to JSON is a tool that converts XML documents into JSON format. Attributes are represented as keys prefixed with “@”, and repeated child elements with the same tag name are automatically grouped into arrays.

This tool is useful for transforming legacy XML API responses into a JSON structure that is easier to process in JavaScript and modern applications.

How to Use

  1. Paste XML text into the input field.
  2. Click "Convert" to transform the XML into JSON.
  3. Optionally customize the attribute key prefix, text key name, and whether attributes should be ignored.
  4. Click "Copy Result" to copy the generated JSON to the clipboard.

FAQ

How are XML attributes converted?

By default, attribute names are prefixed with "@" to create JSON keys (for example, id="1" becomes "@id": "1"). The prefix can be customized.

What happens when multiple elements have the same tag name?

They are automatically grouped into an array.

How are text nodes handled?

If an element contains both child elements or attributes and text content, the text is stored under a "#text" key (which can be customized). If the element has no children or attributes, its text content is used directly as a string value.

Is my data sent to a server?

No. All processing is performed locally in your browser using the built-in DOMParser.