XML ↔ JSON Converter
Paste XML or JSON and convert in either direction. Configurable attribute prefix (`@` / `_`), text key (`#text` / `_text`), CDATA + namespace handling, always-array list for elements that may repeat, compact text output, and pretty-print.
Input
Paste XML or upload a .xml file. Conversion runs as you type.
Output
JSON preview generated from the XML above.
Options
Tune how the converter handles attributes, text nodes, and formatting.
Attribute prefix
Marks XML attributes in the resulting JSON. Use empty to flatten them.
Text node key
Key used for plain text inside an element that also has attributes or children.
Compact text-only elements
Render <p>hi</p> as {"p":"hi"} instead of {"p":{"#text":"hi"}}.
Trim whitespace
Remove leading/trailing whitespace from text nodes.
Surface CDATA
Emit CDATA contents under a dedicated "#cdata" key.
Include namespace declarations
Keep xmlns and xmlns:* attributes in the JSON output.
Always-array element names
Comma-separated tag names that should always become arrays, even with one occurrence.
Indent