XML to JSON Converter
Paste XML and convert it to clean JSON — with configurable attribute/text keys, array handling, namespace mode, CDATA mode, and optional type inference. The Round-trip tab flags where the conversion is lossy (attribute+text, mixed content, repeated siblings), and the JSON → XML tab re-renders the result for comparison. Runs in your browser; nothing is uploaded.
Auto-converts as you type. Ctrl+Enter to re-run.
How to use the XML to JSON Converter
Turn XML into readable JSON locally so it fits the rest of your API debugging workflow — without leaking sensitive data to a third-party service. For SOAP-envelope scoping (Body / Fault) and XPath selection, use the XML / XPath / SOAP Inspector.
When to use it
- You received XML from an API or vendor system but want to inspect it with JSON-first tooling.
- You need to convert an XML response into JSON before sharing it with teammates or test automation.
- You want repeated XML nodes represented as arrays for easier downstream processing.
- You want to check whether an XML → JSON conversion is lossless for your document.
How it works
- Paste the XML into the input.
- Adjust the attribute prefix, text key, arrays, namespaces, CDATA, and type inference options.
- Read the verdict and open the Round-trip tab to see where the conversion is lossy.
- Copy or download the JSON, or hand it off to the JSON Formatter or JSONPath Tester.
Tips & pitfalls
- Keep attributes as
@-prefixed keys when IDs, currencies, or metadata live on XML elements. - Strip namespace prefixes only when downstream tools do not need the original XML names.
- Repeated sibling elements become arrays automatically; switch Arrays to Force all so single occurrences also become arrays for predictable output.
- Leading zeros, UUIDs, large IDs, and dates stay as strings even with type inference on — leave inference off for exact text.
- The Round-trip tab flags attribute+text collisions, mixed content, and repeated siblings that JSON cannot perfectly represent.
Frequently asked questions
Does this tool upload my XML?
No. All parsing, conversion, namespace handling, and reporting run entirely in your browser. Nothing is sent to any server.
How are XML attributes converted to JSON?
By default, attributes are placed under @-prefixed keys (e.g. @id, @currency). You can change the prefix with the Attribute prefix option.
How are repeated XML elements converted to arrays?
Repeated sibling elements automatically become JSON arrays. Single-occurrence elements stay as objects unless you switch Arrays to Force all.
How are XML namespaces handled?
Choose between preserving prefixes in JSON keys or stripping them with the Namespaces option.
Where did SOAP scoping and XPath go?
SOAP-envelope scoping (Body / Fault) and XPath selection live in the XML / XPath / SOAP Inspector; this converter focuses on whole-document XML to JSON.
What happens to CDATA and comments?
By default CDATA is treated as text and comments are dropped. Switch CDATA mode to Separate to keep CDATA under a #cdata key.
Why is XML to JSON not always reversible?
XML and JSON have different data models. Attributes, mixed content, element order, comments, and namespaces have no native JSON equivalent, so full round-tripping is not guaranteed — the Round-trip tab flags where it would be lossy.
How do I preserve leading zeros in IDs?
Keep type inference off (the default). With inference on, values like 00123, IDs beyond JavaScript safe-integer precision, UUIDs, and date-like strings still stay as strings.
Runs locally in your browser. No uploads.