JSON ↔ XML
Convert JSON to XML and XML back to JSON, locally, both ways.
Convert JSON objects to XML elements and back
This tool converts a JSON document into indented XML, and parses XML back into JSON, using fast-xml-parser under the hood. It's aimed at working with SOAP payloads, RSS-style feeds, or legacy XML APIs without hand-writing a parser. XML attributes round-trip as JSON keys prefixed with @_, so structure and attributes both survive the conversion. Both directions run in a Web Worker, keeping large documents off the main thread and off any server.
How to use the JSON ↔ XML
- Paste JSON on the left, using an @_ prefix on keys meant to become attributes.
- Click JSON → XML to generate indented, two-space XML markup on the right.
- Switch to XML → JSON to parse pasted XML markup back into JSON.
- Use the swap button to flip direction and keep working from the output.
Attributes use fast-xml-parser's @_ prefix convention in both directions, so an XML attribute such as id="1" becomes the JSON key @_id, and vice versa. Repeated sibling elements need to be represented as a JSON array to round-trip correctly; a single JSON value in that position becomes just one XML element instead of a list.
Frequently asked questions
- How are XML attributes represented in the JSON output?
- Each attribute becomes a JSON key with an @_ prefix on the parent element's object, so an id attribute becomes the key @_id, keeping attributes distinguishable from child elements and text content.
- Does this converter handle XML namespaces?
- Namespaced elements and attributes are parsed as plain keys including their prefix, such as ns:field, rather than being resolved against a namespace URI, since the underlying parser doesn't do namespace resolution.
- Why did my repeated XML elements collapse into one JSON value?
- Converting JSON to XML, a single value produces a single element; to get multiple sibling elements with the same tag name, that key's value needs to be a JSON array, not a scalar.
- Is my XML or JSON payload uploaded to convert it?
- No. Conversion runs in a Web Worker inside your browser, so payloads like SOAP requests or internal API responses stay local and are never sent to a server.