⚡ File · Client-side · No data sent to server

XML to JSON Converter

Paste XML to convert it into pretty-printed JSON. Attributes, text, and repeated tags are handled, and everything runs in your browser so your data never leaves your machine.

XML input
JSON output
Waiting for input… ✓ Copied!
100% private. This tool parses XML with the browser's built-in DOMParser and builds JSON in your browser. Nothing is uploaded or logged.

About the XML to JSON Converter

The XML to JSON Converter turns XML into pretty-printed JSON so you can read it, reuse it in code, or feed it to tools that expect JSON. It handles attributes, text content, and repeated tags, mapping each to a clear JSON shape. It is built for developers, WordPress and API integrators, and anyone moving data between XML feeds, config files, and JSON APIs. Everything runs in your browser using the built-in DOMParser, so your data stays on your device and is never uploaded.

How it works

  1. Paste or type your XML into the input area.
  2. Choose whether to include attributes and whether to compact the output.
  3. Read the JSON result on the right, along with the character and byte count; if the XML is malformed, the status line shows the parser error.
  4. Click Copy to grab the JSON, or Download to save it as a .json file.

Features

  • Converts XML to JSON in the browser with the native DOMParser, with no data sent to a server.
  • Maps attributes to @-prefixed keys, keeps text content, and turns repeated tags into arrays.
  • Toggle to include or drop attributes, and a compact mode for single-line JSON.
  • Inline parser error message when the XML is malformed.
  • Copy to clipboard and Download as a .json file.

Frequently asked questions

Is my XML uploaded anywhere?

No. Parsing and conversion run entirely in your browser using the built-in DOMParser. Nothing is sent to a server or logged.

How are attributes represented in the JSON?

Each attribute becomes a key prefixed with @. For example, <price currency="USD">49.00</price> produces a price object with an @currency key set to USD and a #text key holding 49.00. Turn off Include attributes to drop them.

What happens with repeated tags?

When a parent has more than one child with the same tag name, those children are collected into a JSON array. A single child with a unique tag name stays a plain object or value.

Why do I get a parser error?

DOMParser rejects XML that is not well-formed. Common causes are unclosed or mismatched tags, more than one root element, missing quotes around attribute values, or stray special characters. The status line shows the first line of the parser error to point you to the problem.

Does it work offline?

Yes. After the page has loaded, the conversion runs locally in your browser, so the tool keeps working without an active connection.