HomeToolsConversionXML to JSON Converter

XML to JSON Converter

Parse XML markup documents and transform them into standard JSON structures.

Conversion

XML to JSON

XML Input
JSON Output

What is XML?

XML (eXtensible Markup Language) is a markup language much like HTML, used to store and transport data. Unlike HTML, XML has no predefined tags; you define your own tags designed specifically for your data structure.

Features

  • Attribute Prefixing: Prefix XML attributes (e.g., with @ or _) to distinguish them from standard elements.
  • Ignore Attributes: Optionally exclude XML tag attributes entirely from the output JSON.
  • Array Merging: Automatically merge elements with the same tag name at the same level into a JSON array.
  • Smart Parsing: Automatically parses primitive types like numbers, booleans, and null.
  • Validation: Shows helpful errors if the XML structure contains unclosed tags or syntax issues.

XML Input Example

<store name="Downtown Shop" location="New York">
  <book category="fiction">
    <title>The Great Gatsby</title>
    <author>F. Scott Fitzgerald</author>
    <price>12.99</price>
  </book>
  <book category="science">
    <title>A Brief History of Time</title>
    <author>Stephen Hawking</author>
    <price>18.99</price>
  </book>
</store>

JSON Output Example

{
  "store": {
    "@name": "Downtown Shop",
    "@location": "New York",
    "book": [
      {
        "@category": "fiction",
        "title": "The Great Gatsby",
        "author": "F. Scott Fitzgerald",
        "price": 12.99
      },
      {
        "@category": "science",
        "title": "A Brief History of Time",
        "author": "Stephen Hawking",
        "price": 18.99
      }
    ]
  }
}

Contribute

Find a bug or want to suggest an improvement to this tool?