XML to JSON Converter
Convert XML to JSON with attribute handling, namespace support, array detection, CDATA preservation, pretty-print, custom attribute prefix and text key. Includes reverse JSON→XML, drag-drop, validation, and history. 100% client-side.
About XML to JSON Converter
Convert XML to JSON with attribute handling, namespace support, array detection, CDATA preservation, pretty-print, custom attribute prefix and text key. Includes reverse JSON→XML, drag-drop, validation, and history. 100% client-side. Everything runs locally in your browser — your data never leaves your device.
How to use
- Enter your input in the tool above.
- Adjust any options to your preference.
- Use the Copy or Download buttons to save the result.
- Everything happens locally — your data never leaves your browser.
FAQ
How does XML-to-JSON conversion work?
Each XML element becomes a JSON object property, each attribute becomes a prefixed key (e.g. id="1" → "@id": "1"), and text content is captured under a configurable #text key. Repeated child elements with the same name are automatically detected and collapsed into JSON arrays.
How are XML namespaces handled?
By default, namespaces are stripped (e.g. <ns:foo> → "foo"). You can toggle namespace preservation, in which case the prefix is kept on the element/attribute name (e.g. "ns:foo"). xmlns declarations can optionally be preserved as regular attributes.
How are arrays detected?
When two or more child elements share the same tag name, they are grouped into a JSON array. A single child stays a single object. This mirrors how most production XML→JSON libraries (fast-xml-parser, xml2js) behave.
What extra features does this tool have?
10 extras: (1) Drag-drop XML file. (2) Paste XML text. (3) Live XML validation. (4) Copy/download JSON output. (5) Reverse JSON→XML conversion. (6) Custom attribute prefix (default @). (7) Custom text key (default #text). (8) Collapse empty elements (omit / null / empty string). (9) Trim whitespace option. (10) History (localStorage — last 10 conversions).
Is my XML data uploaded anywhere?
No. All parsing happens in your browser using pure JavaScript. Your data never leaves your device.
What's the maximum input size?
There's no hard limit, but very large XML (> 10MB) may slow the browser. A depth limit (default 100) prevents stack overflow on deeply nested input.
Related tools
7Z Extractor
Inspect and extract files from 7z archives. Detects the 7z signature (0x37 0x7A 0xBC 0xAF 0x27 0x1C), parses the SignatureHeader and StartHeader, lists files from the archive metadata, and extracts STORE-method files when possible. Honest about LZMA compression limitations. 100% client-side.
APK Extractor
Extract and inspect Android APK files in the browser — pure JavaScript APK (ZIP) parser. View AndroidManifest.xml (binary XML detection), list DEX files, resources, and assets, extract individual files, detect app info (package name, version) from manifest. 100% client-side.
ARJ Extractor
Inspect ARJ archives. Detects the ARJ magic (0x60 0xEA), parses header structures, lists file entries with sizes and CRCs, and extracts STORE-method files when possible. Honest about ARJ compression limitations. 100% client-side.