Skip to content
MyDailyTool

XML to JSON Converter

Convert XML to JSON for legacy API integration, SOAP responses, and config migration. Handles attributes, namespaces, and text content.

How to use the xml to json converter

Paste XML on the left. JSON appears live on the right. Elements become object keys; attributes are prefixed with "@_"; text content of mixed elements lives under "#text".

Formula & explanation

<tag attr="v">text</tag> becomes {"tag": {"@_attr": "v", "#text": "text"}}. Repeated sibling elements collapse into a JSON array.

Examples

<book id="1"><title>Demo</title></book> becomes {"book":{"@_id":1,"title":"Demo"}}

Frequently asked questions

Why does an attribute have an "@_" prefix?
JSON doesn't distinguish attributes from child elements, so we use a prefix to make the distinction visible. This matches the convention used by most XML-to-JSON converters (badgerfish, fast-xml-parser, x2js).
What happens to repeated elements?
Multiple <item> siblings collapse into a JSON array. A single <item> stays as an object — there's no way to distinguish "one element" from "an array of one" without a schema.
Are SOAP responses supported?
Yes. SOAP is just XML, so paste the response body and the envelope structure will be preserved. Use a JSON tool downstream to drill into the soap:Body content.

Related developer tools tools