Anyrow
Log InGet Started

Free online tool

Free Online XML to JSON Converter

Convert XML to JSON online for free. Preserves attributes under @_ prefix. Handles CDATA, mixed content, and namespaces. Powered by fast-xml-parser. 100% client-side — your data never leaves your browser.

01How it works

01

Paste your XML

Paste any XML document. Attributes, text nodes, CDATA, and nested elements are all handled.

02

Click Convert

The XML is parsed and the result is pretty-printed as JSON with two-space indentation.

03

Copy or download

Copy the JSON to clipboard or download it as output.json.

FAQ

Frequently asked questions

How are XML attributes represented in the JSON output?

XML attributes are preserved as keys prefixed with @_ in the JSON output. For example, an element <user id="42"> becomes {"@_id": "42"} alongside any child elements. This convention lets you round-trip the data back to XML without losing attribute information.

How is mixed content (text and child elements together) handled?

Mixed-content elements (elements containing both text and child elements) expose the text portion under the key #text in the JSON output. For example, <p>Hello <b>world</b></p> becomes {"#text": "Hello "}.

What happens to XML namespaces?

XML namespaces (xmlns declarations and prefixed elements like ns:tag) are treated as regular attributes and element names. The namespace prefix is preserved literally in the JSON key. No namespace resolution or stripping is performed.

Are CDATA sections and XML comments preserved?

CDATA sections are handled by fast-xml-parser and their content is included as text in the output. XML comments are ignored. Processing instructions are not included in the JSON output.

Other free tools

JSON to CSV ConverterCSV to JSON ConverterJSON Formatter & ValidatorBrowse all tools →

Need AI-powered document extraction?

This tool uses client-side processing. anyrow uses AI to extract structured data from PDFs, images, and scanned documents with 99% accuracy. 150 free extractions/month — no credit card required.

Try anyrow freeSee how it works