XML to JSON
Convert XML to JSON under an explicit, documented mapping policy.
Browser onlyYour data never leaves this device.
Parsing and conversion all run in your browser, in a background worker when available. The document never leaves the device.
Details: Privacy policy
Input
Drop files here or Browse
Drag and drop works here too.One UTF-8 XML file up to 10 MB. DTDs and entities are refused before parsing.
How XML becomes JSON here
- Attributes
- Kept behind the "@_" prefix when enabled, dropped entirely when disabled.
- Text
- Stored under the chosen text key, always as text — numbers never become numbers.
- Repeated tags
- Automatic mode arrays repeats only; uniform mode arrays every element.
- CDATA
- Merged into the surrounding text like any other character data.
- Entities
- Only the five predefined XML entities decode; unknown ones pass through literally, never expanded from anywhere.
- Round-trip
- Not promised: attributes, key names, and array shapes depend on these choices.
DOCTYPE and ENTITY declarations are refused before parsing, so external entities and expansion games never reach the converter. Change an option and convert again — the last result always matches the options above it. Everything runs in this tab.
Result
No JSON yet.
Choose an XML file to convert it under the policy above.
XML to JSON converts a document under rules printed on the page itself, because XML and JSON do not map onto each other without decisions. Attributes go behind an @_ prefix, element text goes under a key you choose, and repeated elements become arrays either only when they repeat or uniformly for every element of that name - a distinction that changes the shape of everything downstream and is therefore a control rather than an assumption. Values are kept as text, never retyped into numbers or booleans, so nothing is lost to a guess. DOCTYPE and ENTITY declarations are refused before parsing begins, which closes the door on external entities and expansion attacks; unknown entities pass through literally and only the five predefined XML entities decode. CDATA merges into the surrounding text. One UTF-8 file per conversion, up to ten megabytes. It is the tool for turning a feed into JSON for a script, for previewing how attribute-heavy markup maps before a schema is committed, and for converting config XML the same way twice.
How to use XML to JSON
- Drop one XML file.
- Set attributes, text key, and array policy against the printed mapping.
- Copy or download the JSON.
What you get
- JSON built under the mapping printed on the page: attributes behind @_, text under your chosen key.
- Repeated elements emitted as arrays by nature or uniformly, according to the policy you select.
- A refusal of DOCTYPE and ENTITY declarations before parsing, so no external entity is ever resolved.
When to use XML to JSON
- Turn an XML feed into JSON for a JavaScript pipeline.
- Preview how attribute-heavy XML maps before committing to a schema.
- Convert config XML with an explicit, repeatable mapping.
- Compare two feeds' attribute conventions before writing the adapter that consumes them.
Frequently asked questions about XML to JSON
Will converting twice give back my XML?
Not promised. Attribute prefixes, key names, and array shapes follow the chosen policy, so the mapping is one-directional by design.
Why refuse DOCTYPE declarations?
They can carry entity definitions this tool never resolves — external or expanding. Refusing them keeps conversion total and safe.
Do numbers stay numbers?
No: every value stays text, deliberately. Silent retyping corrupts identifiers, so 00123 remains the string 00123.
Is anything uploaded?
Nothing. Parsing and conversion run in your browser — in a background worker when one is available — and bytes are released on clear.
Guides that compare XML to JSON
Tools related to XML to JSON
- JSON to CSV
Flatten a JSON array of objects into spreadsheet-ready CSV.
- JSON Tree Viewer — browse JSON as a collapsible tree with search and path
Browse JSON as a collapsible tree with search and path copy.
- JSON YAML Converter
Convert JSON to YAML or YAML to JSON locally, with readable indentation and clear parse errors.
- XML Formatter & Validator — pretty-print and validate XML with entity-safe local
Pretty-print and validate XML with entity-safe local parsing.
- JSON Formatter & Validator
Pretty-print, minify, and validate JSON with line-precise errors.
- CSV Delimiter Converter — switch CSV files between comma
Switch CSV files between comma, semicolon, tab, and pipe delimiters.
⚡Embed XML to JSON on Your Site & Get Badge↓
Embed this in-browser tool into any blog, documentation, or dashboard. Includes an optional dofollow backlink badge to credit Tools Hub.
<iframe src="https://salaq.com/embed/data/xml-to-json" title="XML to JSON — Tools Hub" width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden;max-width:100%;" loading="lazy"></iframe>
<p style="font-size:12px;color:#6b7280;margin-top:6px;font-family:system-ui,-apple-system,sans-serif;">Powered by <a href="https://salaq.com/tools/data/xml-to-json" target="_blank" rel="noopener" style="color:#2563eb;text-decoration:underline;">XML to JSON on Tools Hub</a></p>Feedback
Send feedback about this tool (placeholder — feedback collection is not wired up yet).