XML to JSON Converter
Convert XML documents into readable, valid JSON objects with automatic type parsing and attribute preservation.
Batch workspace
Format multiple files locally in one run.
How to use the XML to JSON
Paste code or file
Paste your raw XML text or upload directly.
Configure options
Choose indentation, dialect, or formatting preferences.
Format & export
Click format, then copy, download, or inspect in tree view.
What is a XML to JSON?
Convert XML documents into readable, valid JSON objects with automatic type parsing and attribute preservation. This tool re-indents and organizes code according to standard style conventions while checking for syntax validity. Everything executes 100% inside your browser, guaranteeing zero latency and complete privacy for API keys, user tokens, and confidential database schemas.
Options Explained
| Option | Description |
|---|---|
| Indent size | Number of spaces per nesting level (0 for minified JSON). |
| Ignore XML attributes | When checked, XML tag attributes (like id='123') are omitted from the JSON output. |
| Auto-parse numbers & booleans | Automatically converts numeric strings (e.g. '44.95') to numbers and 'true'/'false' to booleans. |
| Attribute prefix | Prefix applied to attribute keys in the resulting JSON object. |
Frequently Asked Questions
How does XML to JSON handle XML attributes?
Attributes are preserved as object properties with a configurable prefix (e.g. @_id). You can also choose to ignore attributes entirely.
Does this tool validate XML syntax?
Yes. The parser checks for well-formed XML and reports exact line and column numbers if syntax errors or unclosed tags are detected.
Can I convert XML to minified JSON?
Yes. Set 'Indent size' to 0 in the options panel to produce single-line compact JSON.
Is my XML uploaded to an external server?
No. Conversion executes 100% locally in your browser memory using fast-xml-parser.
How are repeated child tags converted?
Multiple XML elements with the same tag name are automatically aggregated into a JSON array.