XML to JSON
Convert XML to JSON in your browser with options for array handling, attribute merging, and whitespace trimming. Powered by the popular xml2js library. Runs entirely client-side.
About XML to JSON
Uses the popular xml2js library to convert XML into JSON in your browser. Reverse the conversion with JSON to XML, and tidy up the source with the XML Formatter.
Secure & Private Client-Side
This tool runs entirely in your browser. No data is sent to any server, ensuring your information remains private and secure.
About XML to JSON
Convert XML to JSON in your browser with options for array handling, attribute merging, and whitespace trimming. Powered by the popular xml2js library. Runs entirely client-side.
Frequently Asked Questions
What do the conversion options do? expand_more
"Always wrap children in arrays" forces every element into an array. "Merge attributes into elements" puts attributes as sibling keys. "Trim whitespace" removes leading and trailing spaces from text content.
How are XML attributes represented? expand_more
By default attributes become keys prefixed with @ in the JSON output. Enable "Merge attributes into elements" to drop the prefix and treat attributes like child elements.
Can I convert JSON back to XML? expand_more
Yes. Use [JSON to XML](/tools/json-to-xml/) for the reverse, and tidy XML output with the [XML Formatter](/tools/xml-formatter/).
Are namespaces preserved? expand_more
Yes, namespace prefixes are kept as part of the element name. You may need to strip them if your JSON consumer does not expect them.
Is my XML sent anywhere? expand_more
No. The conversion happens entirely in your browser.
Common Use Cases
- Modernization: Convert legacy SOAP or XML payloads into JSON for newer microservices.
- Mobile Apps: Bridge XML APIs into JSON for easier parsing on iOS and Android.
- RSS Parsing: Turn RSS or Atom XML feeds into JSON for client-side rendering.
- Data Migration: Move XML-shaped records into JSON-based databases like MongoDB.