LocalFirstTools.com — data tools that never leave your device
No upload — everything runs on your device

JSON ↔ XML Converter

Convert JSON to XML and back, and pretty-print XML. Nothing is uploaded.

The JSON ↔ XML Converter maps elements, attributes and text nodes between the two formats in the browser; neither document is sent over the network.

JSON
XML
Converted locally — nothing leaves this tab

What does the JSON ↔ XML do?

This converter turns XML documents into JSON and JSON back into XML — useful for legacy SOAP responses, RSS feeds, sitemaps, Maven or Android config files, and any API that still speaks XML. A pretty-print action reindents messy XML without converting it.

How does the JSON ↔ XML work?

Conversion uses the fast-xml-parser library entirely in this tab. XML → JSON first validates the markup (so you get a real error with line and column), then parses elements into objects, repeated elements into arrays, and attributes into keys prefixed with @_. JSON → XML reverses the mapping: object keys become elements and @_-prefixed keys become attributes. Pretty-print reparses the XML preserving element order and comments, then rebuilds it with two-space indentation.

Does this upload my JSON?

No. This page never sends your input to a server — formatting, decoding and hashing all run in this tab, on this device.How that works.

Frequently asked questions

How are XML attributes represented in JSON?

As object keys prefixed with @_. So <book id="bk101"> becomes {"book": {"@_id": "bk101", …}}. Going the other way, any key starting with @_ is emitted as an attribute on its parent element.

Is XML → JSON → XML a lossless round trip?

Not always. JSON has no concept of comments, processing instructions, CDATA sections or the XML declaration, so those are dropped. Text that looks numeric ('39.95') comes back as a JSON number, and a single child element cannot be told apart from a one-item list — so a round trip can normalize the document even when the data survives.

Why did my element order change?

A JSON object groups repeated elements under one key, so siblings with different names that were interleaved in the XML are regrouped by name after a round trip. W3C XML 1.0 makes sibling order significant; JSON objects do not, which is the core mismatch between the two formats.

What JSON can become XML?

An object whose keys are valid XML element names works best. If the root is an array or a primitive, the tool wraps it in a <root> element (and says so in the status bar), because an XML document must have exactly one root element. Keys with spaces or other characters that are illegal in element names will produce invalid XML.

Is my data uploaded to convert it?

No. Validation, parsing and building all run in this tab with the fast-xml-parser library. Nothing you paste leaves your device.

Related tools

Browse alljson toolsor thefull tool directory.