Transform XML data into properly formatted JSON with syntax validation. Drag and drop .xml files or paste content directly into the input area. The converter handles nested elements, attributes, and text content. Elements become JSON object properties with tag names as keys, repeated elements become arrays, and attributes are stored in an @attributes field. Download results as .json files or copy to clipboard for use in other applications.
Convert XML data to JSON format with proper structure and formatting.
Paste your XML content into the input area or drag an .xml file directly onto it. The tool checks XML syntax before conversion. Click "Convert to JSON" to generate formatted JSON output. Invalid XML shows an error message with details about what needs fixing.
XML elements become JSON object properties with tag names as keys. Element text content becomes string values. Nested elements create nested objects. Repeated elements with the same tag name become arrays. Attributes are stored in an "@attributes" object within each element.
XML attributes are preserved in the JSON output using an "@attributes" key. For example, <item id="1">value</item> becomes {"@attributes":{"id":"1"},"#text":"value"}. This keeps attribute data separate from element content.
XML with mixed content (text plus nested elements) stores text in a "#text" field. Empty elements become null values. Self-closing tags convert to empty objects. The root element wraps all content in a single JSON object.