XML ⇄ JSON
Convert XML to JSON and back with explicit attribute and text conventions.
How to use it
- Paste XML on the left and read JSON on the right, or switch the direction for JSON to XML.
- Attributes appear as
@namekeys, element text as#text, and repeated sibling elements as arrays. - Elements that contain only text collapse to a plain string value in the JSON output.
- In the reverse direction the JSON root becomes the content of a
<root>element. - Copy the result into code, a test fixture or a config file.
Common use cases
- Consuming legacy APIs — turn SOAP or RSS-style responses into JSON your code can traverse.
- Building XML payloads — construct JSON in code, then emit properly nested XML with attributes.
- Test fixtures — keep one JSON source of truth and generate both representations from it.
- Data inspection — peek at the structure of an unfamiliar document without writing a parser.
Why it stays private
Both directions run on a small parser embedded in the page. Documents with tokens, endpoints or personal data never leave the browser.
FAQ
Q: Which conventions does the conversion use?
A: Attributes become @name keys, direct text becomes #text, and repeated elements become arrays. An element holding only text and no attributes collapses to that string. These simplified rules match several popular converters, but they are conventions, not a standard.
Q: What XML features are not supported? A: Namespaces are kept verbatim in tag names, processing instructions and DOCTYPEs are skipped, and mixed content (text interleaved with several child elements) loses its interleaving order. Comments are dropped in both directions.
Q: How are special characters handled on the way back to XML?
A: &, <, > and " in any string value are escaped to entities, so text and attribute values always produce well-formed XML.
Your data stays on this device
XML ⇄ JSON runs 100% locally. Everything you paste or drop is processed by your own browser and never transmitted. Nothing is stored on our servers — close the tab and it is gone.
Nothing you type is sent to a server, logged, or used for analytics. The page works even with your network disconnected after first load.