XML to JSON
Convert XML documents to JSON format using the browser DOM parser. Handles attributes, nested elements, and text content.
Click Convert or press Ctrl+Enter...
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.
Features
- 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 Tools
Unix Timestamp Converter
Convert Unix timestamps to human-readable dates and back. Supports seconds and milliseconds.
Number Base Converter
Convert numbers between binary, octal, decimal and hexadecimal bases instantly.
Temperature Converter
Convert between Celsius, Fahrenheit and Kelvin with instant results and formula display.
Unit Converter
Convert length, weight, volume, speed, area and data units. 50+ unit types supported.
Byte Converter
Convert between bytes, KB, MB, GB, TB and PB. Binary (1024) and decimal (1000) modes.
Roman Numeral Converter
Convert Roman numerals to Arabic numbers and back. Supports values up to 3999.