Skip to content
uxTools
Data & Formats

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.

Samples

Input

Paste XML or upload a .xml file. Conversion runs as you type.

0 B0 lines

Output

JSON preview generated from the XML above.

Type or paste XML to see the JSON conversion here.

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