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
- JSON to XML ConverterConvert JSON objects and arrays to well-formed XML. Maps object keys to elements, array items to repeated elements, with optional root wrapper.
- JSON DiffCompare two JSON values semantically. Ignores key order; shows added, removed, and changed fields with their JSONPath — great for diffing API responses and config files.
- JSON to CSV ConverterConvert JSON arrays to CSV with automatic header detection from object keys. Handles nested values and arbitrary delimiters.
- XML to CSV ConverterFlatten repeated XML elements into CSV rows with attributes and child text as columns. Great for opening XML data in Excel or Sheets.
- CSV to JSON ConverterConvert CSV to a JSON array of objects. Uses the first row as keys, handles quoted values, and detects common delimiters automatically.
- CSV to XML ConverterConvert CSV rows into XML elements with column headers as tag names. Useful for Excel exports, legacy systems, and ETL pipelines.