Developer Tools
XML to JSON & JSON to XML Converter
Convert between XML and JSON in either direction. Attributes, nested elements, repeated nodes and text are preserved, and the output is pretty-printed. Everything runs in your browser — nothing is uploaded.
Bridge two of the most common data formats
Legacy APIs, SOAP services, RSS feeds and config files still speak XML, while almost everything new speaks JSON. This converter moves data cleanly in both directions, keeping attributes, element order and nesting intact so you can feed an XML response into JSON tooling — or generate XML from a JSON structure — without hand-editing.
Conversion conventions
- Attributes — mapped to
@namekeys. - Text content — stored under
#textwhen needed. - Repeated elements — collapsed into JSON arrays.
- Pretty-printed — readable, indented output every time.
Frequently asked questions
How are XML attributes represented in JSON?
Attributes are stored on the element object with an "@" prefix — for example, <book id="1"> becomes { "book": { "@id": "1" } }. Element text content is stored under "#text" when the element also has attributes or children.
How are repeated XML elements handled?
When an element name appears more than once inside the same parent, it is collapsed into a JSON array, preserving order. A single occurrence stays as an object, which matches how most XML-to-JSON conventions work.
Can it convert JSON back to XML?
Yes. Switch the direction to JSON → XML. Keys beginning with "@" become attributes, "#text" becomes element text, arrays become repeated elements, and everything else becomes nested tags.
Is my data uploaded?
No. Parsing and conversion use the browser’s native DOMParser and JavaScript. Your XML and JSON never leave your device.