{ }jsonkit
Format
Validate
Convert
Query
Generate

JSON to XML and XML to JSON converter

Handles attributes, arrays and namespaces.
219 B · paste or drop a file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
✓ complete219 B → 259 B0.0 ms

About JSON ⇄ XML

The JSON to XML converter turns JSON into XML and XML back into JSON. Turn an API response into XML for a legacy system, or parse an XML feed into JSON for modern code.

It suits work with SOAP services, RSS and Atom feeds, and older enterprise systems that speak XML. Runs in your browser. Nothing is uploaded.

How it works

JSON to XML

Object keys become element names and values become element content. Nested objects become nested elements. An object with a single top-level key uses that key as the root element. Anything else is wrapped in a <root> element.

Arrays and repeated elements

XML has no array type. Each array item becomes a repeated element with the same tag name, which is the usual way to write a list in XML. Converting back groups repeated elements into an array.

Attributes and namespaces

XML attributes become JSON keys with an @_ prefix, such as "@_id", so they stay separate from child elements. Namespace prefixes are kept in the names, like "atom:link". Going from JSON to XML, keys with the @_ prefix are written as attributes.

Escaping special characters

Characters such as <, > and & are escaped in the XML output, so the document stays well-formed. They are unescaped again when you convert back.

Frequently asked questions

How are JSON arrays represented in XML?

As repeated elements with one shared tag name. Converting back to JSON groups them into an array.

Does it handle XML attributes and namespaces?

Yes. Attributes appear as keys prefixed with @_, and namespace prefixes stay in the element names. Nothing is merged into element text.

Why doesn't the XML round-trip back to identical JSON?

XML and JSON model data differently. XML has no array or number type, so a single-item list and a plain element look the same, and numbers come back from the text. The data is kept, but the exact JSON shape can differ.

Is my document uploaded?

No. Both directions run in your browser.

Are special characters escaped correctly?

Yes. Characters like <, > and & are escaped in the XML output and unescaped on the way back.

Sources & last verified

We checked this tool's behavior and the claims on this page against the specifications below on . The tool runs in your browser, so the output you see is exactly what the engine produced.

Found a wrong result or an outdated claim? Report an error and we will check it again.