Skip to content
Run here 100% in your browser, no upload, no login

XML ⇄ JSON

Convert XML to JSON and back with explicit attribute and text conventions.

How to use it

  1. Paste XML on the left and read JSON on the right, or switch the direction for JSON to XML.
  2. Attributes appear as @name keys, element text as #text, and repeated sibling elements as arrays.
  3. Elements that contain only text collapse to a plain string value in the JSON output.
  4. In the reverse direction the JSON root becomes the content of a <root> element.
  5. Copy the result into code, a test fixture or a config file.

Common use cases

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.