AnkhKit

Convert XML to JSON Online — Free

Runs 100% in your browser — your files never leave your device.

Older APIs answer in XML; modern code wants JSON. Paste XML and get the equivalent JSON: elements become keys, repeated elements become arrays, and attributes are preserved under an @ prefix. Invalid markup does not fail silently — you get the line number and the reason. The parsing runs entirely in your browser.

How it works

  1. 1

    Paste your XML

    Any well-formed document works — attributes and repeated elements included.

  2. 2

    Read the JSON

    Elements map to keys; attributes land under an @ prefix.

  3. 3

    Copy or download

    One click copies the JSON; another saves it as a file.

About this tool

How the conversion works

The tool parses your XML with a real XML parser and maps the tree to JSON: elements become objects, attributes get their own representation, text content lands as values, and repeated sibling elements become arrays. The mapping follows the established conventions of the standard XML-to-JSON converters.

The mapping is lossy by nature

XML carries concepts JSON does not: attributes versus child elements, namespaces, text mixed with children, processing instructions. The converter makes reasonable, conventional choices — inspect the output and adjust if your consumer expects a different convention.

The modern-target use case

XML arrives from legacy SOAP services, enterprise exports, and older feeds; the JSON output flows into modern APIs and JavaScript. This conversion is the bridge — parse here, consume the JSON anywhere.

Frequently asked questions

How do XML attributes appear in the JSON?

Attributes are represented distinctly from child elements so you can tell them apart — the conventional prefix marks them in the output object.

Why did my single element become an array (or not)?

One occurrence produces a value; repeated siblings produce arrays. Some converters always wrap in arrays — check your consumer's expectation if consistency matters.

Does it validate my XML first?

Yes — parsing fails loudly on malformed XML with the error pointing at the problem, rather than producing a broken JSON half-convert.

More data converters