XML to JSON Converter

This tool converts XML input into clean, structured JSON instantly. Whether you’re working with data feeds, configuration files, or markup from another system, this tool helps you visualize the XML structure in JSON format. It supports two output modes (simple or verbose), optional pretty-printing, whitespace control, and works right in your browser.

Paste your input above or import a file below.
No file chosen
Supported file types: .xml, .txt, .html
Total characters: 0
Options
Pretty print JSON
Strip text whitespace

How to Use:

  1. Paste your XML into the left text box tags, attributes, and nested elements are all supported.
  2. Or click Choose File to upload an XML or HTML file.
  3. Use the Options box to adjust behavior:
    • Conversion Mode:
      • Simple: Returns the contents inside the root tag directly.
      • Verbose: Wraps everything under the root tag name for full structure.
    • Pretty print JSON: Adds indentation and line breaks for readability.
    • Strip text whitespace: Trims text nodes for cleaner output.
  4. The JSON output updates live in the right box.
  5. Click Copy Output or Export to File to save your result.
  6. Hit Clear All to reset and start fresh.

What the XML to JSON Converter Tool can do:

It reads valid XML and builds a JSON object that reflects the tag structure, attributes, and values. It supports lists of repeated elements, text nodes, nested trees, and can optionally include @attributes objects for each tag. The result is formatted as standard JSON, ready for APIs, debugging, or transformation into JavaScript objects.

Example:

Input:

<note>
<to>Tove</to>
<from>Jani</from>
<body>Don't forget me this weekend!</body>
</note>

Output (Pretty):

{
"to": "Tove",
"from": "Jani",
"body": "Don't forget me this weekend!"
}

Common Use Cases:

This tool is perfect for developers converting XML APIs to JSON, editors transforming data for NoSQL storage, and analysts needing a clean view of structured XML. It helps verify, clean, and convert XML into usable formats fast no server, libraries, or coding required.

Useful Tools & Suggestions:

If you’re going the other way, JSON to XML Converter helps bring structured data back into an XML format great for working with legacy systems or document-based tools. And when you want something more readable for config files, XML to YAML Converter offers a clean, indentation-based format that’s easier to work with manually.