XML-JSON Converter
Convert between XML and JSON formats instantly in your browser. Auto-detects input format, so just paste and convert. Great for XML-to-JSON API integration.
Last updated:
How to Use
Expand how to useCollapse how to use
- 1
Input
Paste XML or JSON into the input area. The format is automatically detected.
- 2
Convert
Click the "Convert to JSON" or "Convert to XML" button.
- 3
Copy
Copy the conversion result to the clipboard using the copy button.
Input
Output
About XML-JSON Converter
XML-JSON Converter transforms XML documents and JSON objects between formats instantly, with automatic input detection. Paste a SOAP API response, an RSS feed, a Maven pom.xml, or a Spring beans configuration file and receive clean, indented JSON in one click. Conversion in the other direction is equally simple — paste a JSON object and export it as well-formed XML. XML attributes are mapped to JSON keys prefixed with @ and text content is stored under the #text key, preserving the full information of the original document. Indentation for both output formats is configurable (2 spaces, 4 spaces, or tabs). A swap button lets you reverse input and output for iterative testing.
Key Features
- Auto-detection (automatically determines if input is XML or JSON)
- Bidirectional conversion (XML→JSON and JSON→XML)
- Customizable indentation (2 spaces/4 spaces/tabs)
- XML attribute handling (converted to special JSON keys)
- Swap feature to switch input and output
Common Use Cases
- Convert SOAP API XML responses to JSON for modern REST integration
- Parse RSS or Atom feed XML into JSON for processing with JavaScript
- Migrate legacy XML config files (Maven pom.xml, Spring beans) to JSON
- Inspect complex XML structures by converting to readable JSON
- Generate XML output from JSON data for systems requiring XML input
Frequently Asked Questions
What's the difference between XML and JSON?
XML is a markup language that uses opening and closing tags, attributes, and namespaces to represent hierarchical data. It supports comments, processing instructions, and schema validation. JSON is a lightweight key-value format derived from JavaScript object notation. It is simpler and produces smaller payloads, which is why most modern REST APIs use JSON rather than XML.
How are XML attributes handled in conversion?
XML attributes are converted to JSON keys prefixed with @. For example, <item id="1"> becomes {"@id": "1"}. Text content within an element is stored under the key #text, so <name>Alice</name> that also has attributes becomes {"@attr": "value", "#text": "Alice"}. This mapping is reversible so round-trip conversions preserve all data.
What data cannot be converted?
XML comments (<!-- -->) and processing instructions (<?...?>) are dropped during conversion because JSON has no equivalent constructs. XML namespace prefixes are included as part of the key name. CDATA sections are expanded as plain text strings.
How is the input format detected?
The tool looks at the first non-whitespace character. A < indicates XML; a { or [ indicates JSON. The detected format is shown above the input area. If detection is incorrect, verify that your input starts with the expected character.
Can I convert RSS or Atom feeds?
Yes. RSS and Atom feeds are valid XML documents, so you can paste the raw feed content and convert it to JSON. This is useful when you want to process feed entries with JavaScript or store them in a JSON-based database. Note that namespace prefixes such as dc: or atom: will be preserved as part of key names.
Is my input data sent to a server?
No. Parsing and serialization run locally in your browser. You can safely convert confidential XML payloads such as internal SOAP responses or Spring configuration files.
