XML to JSON
Convert XML documents into readable, valid JSON objects with automatic type parsing and attribute preservation. · Updated
Options
Indent size:
Attribute prefix:
xml
json
Draft saved locally.
Options
| 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. |
FAQ
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.
How are repeated child tags converted?
Multiple XML elements with the same tag name are automatically aggregated into a JSON array.
Related tools
JSON to XML
Convert JSON documents into clean, structured, and customizable XML markup instantly.
XML Formatter
Format, beautify, and validate messy XML files with custom indentation and instant syntax error detection.
JSON Formatter
Format, validate, and explore JSON with a collapsible tree view.
Diff Checker
Compare two text or code snippets side-by-side to highlight added, removed, and modified lines instantly.