Code BeautifierDev Tools

XML to JSON Converter

Convert XML documents into readable, valid JSON objects with automatic type parsing and attribute preservation.

Runs 100% in your browser · Zero server logs
Your draft is saved locally in this browser. No editor content leaves this device unless you explicitly share it.

Batch workspace

Format multiple files locally in one run.

Indent size:
Attribute prefix:
Inputxml
json

How to use the XML to JSON

1

Paste code or file

Paste your raw XML text or upload directly.

2

Configure options

Choose indentation, dialect, or formatting preferences.

3

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

OptionDescription
Indent sizeNumber of spaces per nesting level (0 for minified JSON).
Ignore XML attributesWhen checked, XML tag attributes (like id='123') are omitted from the JSON output.
Auto-parse numbers & booleansAutomatically converts numeric strings (e.g. '44.95') to numbers and 'true'/'false' to booleans.
Attribute prefixPrefix 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.