XML to JSON Converter – Convert XML to JSON Online
Convert XML into JSON.
1 · Input
2 · Output
Attributes are prefixed with @ and mixed-in text is kept as #text, so an attribute is never confused with a child element of the same name. Repeated sibling elements become an array.
Other Tools
Popular tools from across A2Z
XML to JSON Converter
Our online XML to JSON converter tool allows users to convert an XML file into a JSON file without hassle. However, this process is not 100% accurate as the XML uses various item types that do not have similar JSON representations. Moreover, XML to JSON Converter is an easy and simple tool. Just Copy, Paste, and Convert.
Follow the below steps to convert an XML file to JSON:
- Go to A2Z Tools
- Click on XML to JSON Converter
- Now add the XML text and the JSON format will be generated
- Click on Copy to use the file
XML to JSON Example
XML Data
<?xml version="1.0" encoding="UTF-8" ?> <InsuranceCompanies> <Top_Insurance_Companies> <Name>Berkshire Hathaway ( BRK.A)</Name> <Market_Capitalization>$539 billion</Market_Capitalization> </Top_Insurance_Companies> </InsuranceCompanies>
Converted JSON
{
"InsuranceCompanies": {
"Top_Insurance_Companies": {
"Name": "Berkshire Hathaway ( BRK.A)",
"Market_Capitalization": "$539 billion"
}
}
}
Rate this tool
Was this tool useful? Your feedback helps us improve it.
Quick answer
Paste your XML data and the tool instantly converts it into the equivalent JSON structure.
Key facts
- Runs entirely in your browser via JavaScript
- Converts XML elements and attributes into a corresponding JSON structure
- No file upload or server round-trip involved
- Free with no usage limit
- Complex XML features (like namespaces) may map to JSON in tool-specific ways
What is this tool?
This tool converts XML data into JSON format, useful when working with systems or APIs that require JSON but your source data is in XML.How to use it
Paste your XML into the box; the equivalent JSON structure appears instantly, ready to copy.- Paste your XML data into the input box.
- The tool instantly converts it into the equivalent JSON structure.
- Copy the resulting JSON.
Example
Example: converting `How it works
The page uses a JavaScript XML parser to read your XML's element and attribute structure, then maps it onto an equivalent JSON object/array structure, entirely in your browser.Common use cases
- Converting legacy XML data for use with a JSON-based API.
- Migrating configuration files from XML to JSON format.
- Inspecting XML data in a more compact JSON view.
- Preparing XML-sourced data for JavaScript applications that expect JSON.
Benefits
Free, instant, and saves manual restructuring of data between formats.Limitations
XML features like attributes, namespaces, and mixed content don't have a single universal JSON equivalent, so different converters may represent these differently -- review the output structure to ensure it matches your needs, especially for complex XML.Privacy & your data
Conversion happens entirely in your browser using JavaScript. Your XML data is not sent to or stored on the A2Z Tools server.Frequently asked questions
How are XML attributes represented in the JSON output?
Does this handle XML namespaces?
Is my XML data sent to a server?
Is this tool free to use?
Last reviewed: