XML to JSON
Convert XML documents to JSON format using the browser DOM parser. Handles attributes, nested elements, and text content.
- 100% free
- No sign-up
- No limits
- Instant results
Click Convert or press Ctrl+Enter...
- Uses browser DOMParser for reliable XML parsing
- Attributes converted as @attribute keys
- Text content preserved as #text
- Handles nested elements and arrays
- Clear error messages for malformed XML
What is XML to JSON Converter?
XML to JSON is a conversion tool that transforms XML (Extensible Markup Language) documents into JSON (JavaScript Object Notation) format.
It uses the browser's built-in DOMParser for reliable XML parsing, converts element attributes to @attribute keys, preserves text content as #text values, and automatically detects arrays when multiple sibling elements share the same tag name. Ideal for converting API responses, config files, or data feeds from XML to JSON.
How to use XML to JSON Converter
- 1
Paste your XML
Enter or paste XML content into the left text area. Click Load Example for a sample document.
- 2
Click Convert
Press Convert or Ctrl+Enter to parse the XML and generate JSON output.
- 3
Review the JSON
The formatted JSON appears in the right panel. Attributes appear as @attr keys, text content as #text.
- 4
Copy the result
Click Copy to copy the JSON to your clipboard for use in your code or APIs.
Everything this tool
does for you
- Browser DOMParser for reliable XML parsing
- Attributes converted as @attribute keys
- Text content preserved as #text values
- Automatic array detection for repeated siblings
- Handles nested elements of any depth
- XML declaration and processing instructions handled
- Clear error messages for malformed XML
- Pretty-printed JSON output with 2-space indentation
Related free tools
Frequently asked questions
This tool fixed one thing.
Now fix the whole site.
Our scanner runs 240+ checks across 10 audit areas, ranks every issue by the score points it costs, and hands you the code to paste.
Run a free audit