DevConvertor

XML to JSON

Convert XML to JSON using the same documented mapping as the JSON to XML converter (attributes as "@_" keys, text as "#text", repeated elements as arrays). Well-formedness is checked with the browser's native XML parser first, so malformed XML is reported rather than converted incorrectly.

ReadyData ConvertersFree · No account required

Features

  • Real well-formedness validation before conversion, not a best-effort parse
  • Attributes become "@_name" keys, text content becomes "#text" (or a plain string when an element has no attributes or children), and repeated sibling elements become a JSON array.

How to use

  1. Paste XML into the input.
  2. Click Convert.
  3. Copy or download the resulting JSON.

Example

Input

<root>
  <item id="1">a</item>
  <item id="2">b</item>
</root>

Output

{"root":{"item":[{"@_id":"1","#text":"a"},{"@_id":"2","#text":"b"}]}}