XML to JSON Converter
Convert XML into JSON and back, with control over how attributes and text nodes are named.
Leading zeros are kept as text so postcodes survive.
How the shapes map
- <a>1</a> becomes "a": "1"
- <a id="1">x</a> becomes "a": { "@id": "1", "#text": "x" }
- Two <item> elements become "item": [ … ]
- <a/> becomes "a": ""
Files are processed in your browser and are never uploaded to a server.
How to use
Free to use with no sign-up, no install and no usage limit.
Paste XML and get JSON, or switch direction and go the other way. Both run as you type.
Plenty of things still speak XML: older enterprise APIs, bank and government integrations, RSS feeds, SOAP responses, and every Office file format underneath the zip. Working with them from modern code usually means converting first.
Elements with no attributes and no children collapse to a plain value, so a simple document stays simple. Without that rule every leaf becomes an object and the result is tedious to read and worse to write against.
An element name that appears twice becomes an array. Overwriting instead would silently drop everything but the last one — the kind of bug that surfaces weeks later when a list happened to have one item during testing.
Attributes are prefixed and text goes in its own key, because XML lets an element carry both while JSON has only one slot per name. Both markers are configurable in case they collide with names in your data.
Converting numbers is off by default. A postcode of 01234 becomes 1234 as a number, and a version string of 1.10 becomes 1.1 — losses that are invisible until something downstream breaks.
Some things do not survive the trip: XML allows several children with the same name in a specific order, and JSON objects have no order at all. Round-tripping a document is reliable for data, not for documents that care about their layout.
Nothing you paste is sent to a server. The parsing runs inside your browser.