How to Use the XML to JSON Converter
- Paste your XML document into the input box.
- Click "Convert" to parse it into an equivalent JSON structure.
- Copy the JSON output or download it as a .json file.
Why XML and JSON don't map perfectly
XML has concepts JSON doesn't natively have, such as attributes on an element, mixed text and child-element content, and namespaces. This converter represents attributes with an "@" prefix and text content with a dedicated key, which is a common and readable convention, but be aware there is no single universally "correct" XML-to-JSON mapping — different tools make different choices.
When this conversion is useful
This is useful for working with legacy SOAP/XML APIs from a modern JSON-based codebase, quickly inspecting the structure of an XML configuration file, or migrating data from an XML-based system into a JSON-based one.
Example
<person id="1"><name>Ada</name></person>
{
"person": {
"@id": "1",
"name": "Ada"
}
}
Tips
- Review the output structure carefully — XML-to-JSON mapping conventions vary between tools.
- Repeated sibling elements are converted into a JSON array automatically.
Frequently Asked Questions
How are XML attributes represented in the JSON output?
Attributes are prefixed with "@" as object keys, distinguishing them from child elements and text content.
Does this validate my XML?
It uses your browser's built-in XML parser, which will report a parsing error for malformed XML, but this tool is not a full schema validator.