XML to JSON Converter — Attributes, Repeated Elements and Text
Developer Tools
About This Tool
Convert one XML document to JSON with optional attributes and whitespace trimming. Inspect repeated elements, inferred values and conversion limits.
How to Use
- Paste one well-formed XML document.
- Choose whether to include attributes and trim text.
- Convert and inspect the JSON or parsing error.
- Copy the result after checking inferred values.
How XML maps to JSON
The document root becomes a JSON key. Repeated sibling elements become arrays, including empty, zero and false values. Attributes use an @ prefix when enabled. Text and CDATA are retained; text alongside attributes or child elements uses #text.
Values and limitations
Leaf text matching true, false or null becomes the corresponding JSON value. Numeric text is inferred automatically, except unsafe integers, which remain strings. Leading zeros can be lost and decimals follow JavaScript number precision. There is no separate type-inference toggle.
Not a reversible XML format
Only one document is accepted. Mixed text is combined, so its order relative to elements is not preserved. Comments, processing instructions and namespace semantics are not fully represented. Trimming changes text whitespace. Use this for inspecting structured data, not lossless XML storage. Shared services appear in the privacy policy.
Frequently Asked Questions
Can I paste several XML documents together?
Does conversion preserve every XML detail?
Are types inferred?
Guides & Tutorials
In-depth guides for every tool. Learn how to process your data privately, for free, right in your browser.
Read more