Free XML to JSON Converter Online
Convert XML to JSON format instantly in your browser — no server, no signup, 100% private.
Input XML
Output JSON
What Is XML to JSON Conversion?
Working with a SOAP service, RSS feed, or legacy enterprise API? Chances are the response is XML — but your app speaks JSON (defined in RFC 8259). Converting XML to JSON maps elements to objects, attributes to properties, and repeated elements to arrays. There's no universal standard for the mapping — tools like xml-js and the browser's built-in DOMParser each make different choices. This tool shows you what the conversion looks like before you write any code. The W3C XML page has more on the format. Output runs entirely in your browser — nothing uploaded.
Conversion runs in your browser. You can choose compact or formatted output. Nothing is sent to a server. The W3C XML spec defines the input format.
How to Use This Tool
Paste or Upload XML
Paste XML into the left editor or upload a .xml file. Use Sample for example data. Toggle Compact Output in settings for minified JSON.
View JSON Output
The right panel shows the converted JSON. Elements become objects; attributes may be in a separate key. Repeated elements may become arrays. Invalid XML will show an error.
Copy or Download
Use Copy or Download to get the JSON. For the reverse, use JSON to XML. For formatting XML first, use XML Formatter.
XML to JSON Examples
Here is an example of converting XML to JSON.
Example: Subscriber record
XML input:
Generated JSON output:
Where XML to JSON Helps
Converting XML to JSON is useful when integrating legacy XML APIs with modern JSON-based systems, when building web apps that consume SOAP or RSS feeds, or when migrating data pipelines to JSON. Many APIs and databases prefer JSON; this tool helps bridge the gap. Use it to inspect how your XML would look as JSON before writing conversion code.
XML to JSON Mapping
There's no single standard mapping. Elements become objects; attributes may be prefixed (e.g. @attr) or in a separate object. Text content may be in a #text key. Repeated elements typically become arrays. The exact mapping depends on the implementation. Libraries like xml-js or DOMParser are used under the hood.
Frequently Asked Questions
How are XML attributes handled in the JSON output?
It depends on the converter. Common approaches include a separate @attributes object, or keys prefixed with @. Check the output carefully — attributes don't have a universal JSON equivalent.
What happens with XML namespaces?
Namespace prefixes may appear in JSON keys (e.g. soap:Body). The full URI might be preserved or stripped. Always check the result for your specific namespace usage.
Is my XML data sent to a server?
No. All conversion runs locally in your browser using JavaScript. Nothing is uploaded or transmitted.
Can I convert JSON back to XML?
Yes. Use the JSON to XML converter on this site for the reverse direction.
What if my XML is invalid?
The tool will show an error message. Use the XML Validator first to find and fix errors in your XML before converting.
Related Tools
For XML, see the W3C XML specification. For JSON, see json.org, RFC 8259, and MDN JSON. For parsing XML in the browser, see MDN DOMParser. For XML-to-JSON libraries, see xml-js. The W3C XML page has more on the format.