XML to JSON Converter

Convert XML to JSON, keeping attributes and repeated elements as arrays, with pretty or compact output.

Converter

Was this tool useful?

About this tool

About XML to JSON Converter

Turn XML feeds, sitemaps and API responses into JSON that is easy to use in JavaScript and other languages.

How it works

Attributes become @name keys, text becomes #text (or a plain value when there are no attributes), repeated elements become arrays.

Example

<book id="1"><title>PHP</title></book> → {"book":{"@id":"1","title":"PHP"}}

How to use this tool

  1. Paste XML.
  2. Choose how attributes are named and whether to always use arrays.
  3. Copy or download the JSON.

Frequently asked questions

Is my code uploaded?

No. Everything runs in your browser, so your code and data stay on your device.

Is the conversion reversible?

Yes – use the JSON to XML tool with the same @ and #text conventions.

Does the XML to JSON Converter send my data to a server?

No. The XML to JSON Converter runs entirely in your browser using JavaScript, so tokens, code and data you paste stay on your device. You can even use it offline once the page has loaded.