Bytelify

XML to JSON Converter

Convert XML to JSON instantly, live as you type.

Runs in your browser, nothing sent
xml-to-json-converter
JSON

Converts live as you type, entirely in your browser. There's no single official XML-to-JSON standard โ€” repeated sibling elements with the same tag name become an array, the most common convention. Invalid XML shows the parser's exact error message.

Need the opposite? JSON to XML Converter

What is XML to JSON Converter?

Paste XML and get an equivalent JSON document instantly, using your browser's native XML parser rather than a hand-rolled one, so parsing behaves the same way a browser would treat the markup. There's no single official XML-to-JSON standard, but repeated sibling elements with the same tag name become an array here, the most common convention followed by most other XML-JSON converters, so results are easy to reason about if you've used a similar tool before. Handy for working with legacy APIs or config formats that only speak XML when the rest of your tooling expects JSON: SOAP responses, RSS/Atom feeds, or an old settings file. Conversion happens live as you type, entirely in your browser; nothing you paste is sent to a server.

How to Use the XML to JSON Converter

  1. 1

    Paste the XML: Enter any well-formed XML document, such as a SOAP response or RSS feed.

  2. 2

    Read the JSON Result Instantly: The equivalent JSON structure appears automatically as you type.

  3. 3

    Copy the Result: Use the copy button to copy the JSON for use in your application.

How the Mapping Works

Each XML element becomes a JSON key, with its content as the value. A single child element becomes a plain object; multiple sibling elements sharing the same tag name become a JSON array under that key, since JSON has no native way to represent repeated keys the way XML naturally allows repeated tags. Element attributes are kept alongside the element's content rather than discarded, so no information from the original XML is lost in the conversion.

Example

JSON
Input XML:
<book id="1">
  <title>Dune</title>
  <author>Frank Herbert</author>
</book>

Output JSON:
{
  "book": {
    "@id": "1",
    "title": "Dune",
    "author": "Frank Herbert"
  }
}

With repeated sibling elements, e.g. multiple <author> tags under one <book>, the author key becomes a JSON array of strings instead of a single string, since there's more than one value to hold.
FAQs

Frequently Asked Questions

Common questions about XML to JSON Converter.

Sibling elements sharing a tag name become a JSON array under that key, the same convention this site's JSON to XML Converter uses in reverse.

The tool shows the browser parser's exact error message.

Yes, attributes and text content are both carried over into the resulting JSON structure, not just element names and nested tags.

Yes, see the paired JSON to XML Converter, which uses the same array convention in reverse.

No. Unlike XML and JSON's own specs, there's no single official mapping between the two formats; different tools and libraries make slightly different conventions for attributes, text content, and repeated elements. This tool follows the common, widely-used convention of folding repeated sibling tags into an array.

It guarantees the same parsing behavior and error reporting a browser would give when loading the XML directly, rather than risking subtle differences from a hand-rolled parser.

Yes, Bytelify's XML to JSON Converter is free with no account or sign-up required.

No. The conversion runs entirely client-side in your browser, so nothing you paste is sent anywhere.