XML ⇄ JSON
Loading tool…
About XML ⇄ JSON
XML to JSON: paste or upload XML. Options: Keep attributes (@name), Keep root element, Pretty JSON (all default on). Download JSON and Copy. Invalid XML reports Invalid XML at line N. Attributes use an @ prefix. Text nodes use #text. Processing instructions are ignored.
JSON to XML: paste or upload JSON. Root element defaults to root. Pretty print and XML declaration default on (declaration is <?xml version="1.0" encoding="UTF-8"?>). Download XML and Copy. Arrays under root wrap as items/item. JSON keys that are not valid XML names are sanitized or rejected with a message. There is no 20-row table preview on either tab.
How to use XML ⇄ JSON
- 1Pick a tab. XML to JSON or JSON to XML.
- 2Paste or upload a file. UTF-8 expected. Upload is 15MB max.
- 3Set options. Attributes and root one way. Root name, pretty print, and declaration the other.
- 4Download JSON or Download XML. Copy is on both tabs. Pretty print is on by default.
XML to JSON
Namespaces stay in the names; we do not rewrite xmlns graphs. Booleans and null in a later JSON round trip will not match the original XML types exactly.
JSON to XML
If Root element is still root, a top-level array uses items and item. A named root uses that name and a singular child tag. UTF-8 is expected on paste and upload.
Limits and privacy
XML to JSON and JSON to XML both run in your browser. Each upload is 15MB. Paste is not size-capped. Do not paste secrets you are not allowed to process on this device. No account.
FAQs
- Are XML namespaces rewritten?
- No. Prefixes stay as part of names. We do not rebuild xmlns graphs.
- What if a JSON key is not a valid XML name?
- It is sanitized when possible, or rejected with a message that names the key.
- Will a round trip look identical?
- Not always. JSON booleans and null have no single XML mapping.
- How are attributes represented?
- On XML to JSON they become keys prefixed with @ when Keep attributes is on.
- Is there a table preview?
- No. You get the JSON or XML text. Spreadsheet converters have the 20-row table.