XML to JSON Converter
What is XML to JSON Conversion?
XML to JSON conversion transforms XML (eXtensible Markup Language) data into JSON (JavaScript Object Notation) format. This is useful when modernizing legacy systems, working with REST APIs that expect JSON, or when you need a more compact and easier-to-parse data format.
How to Use
Basic Steps
- Paste or enter XML data in the left input box
- Select indent size (2 spaces, 4 spaces, or Tab)
- Converted JSON displays on the right with syntax highlighting
- Review the conversion result and fix any XML errors
- Click Copy or Download to save the result
Features
Examples
Simple Element
<root>
<name>John</name>
</root>
→
{"root": {"name": "John"}}Repeating Elements
<root>
<item>A</item>
<item>B</item>
</root>
→
{"root": {"item": ["A", "B"]}}Nested Structure
<root>
<user>
<name>John</name>
<age>30</age>
</user>
</root>
→
{"root": {"user": {"name": "John", "age": 30}}}FAQ
How are XML elements converted to JSON?
XML elements become JSON object properties. Child elements become nested objects. For example, <name>John</name> becomes {"name": "John"}.
How are repeating XML elements handled?
When the same element name appears multiple times as siblings, they are automatically grouped into a JSON array. For example, two <item> elements become an "item" array.
Are XML attributes supported?
Currently, element text content and child elements are converted. Attributes are not preserved in the conversion, focusing on the structural content of the XML.