🔀

JSON ↔ XML Converter

Map nested objects, arrays, attributes and text nodes between JSON and XML with configurable naming, formatting and validation.

BidirectionalPrivate in browserValidated output

JSON input

0 characters

XML output

Review the mapping before using it in production
Your converted output will appear here.
0 nodes0 bytesJSON → XML
🏷️

Attributes and text

With the defaults, @id becomes an XML attribute and #text becomes text inside the element. Change the conventions to match your existing JSON format.

📚

Array mapping

An array stored under a property repeats that property’s element name. A top-level array uses the configured fallback item name inside the root element.

Valid XML names

Element and attribute names are validated rather than silently changed. Keys containing spaces or invalid starting characters must be renamed before conversion.

Understand JSON and XML mapping

JSON distinguishes objects, arrays and primitives; XML uses elements, attributes and ordered text. There is no single lossless universal mapping, so choose conventions that the receiving system understands and validate the generated document against its schema when one exists.

How are null, false and zero handled?

Zero and false are preserved as text values. Null becomes an empty element. With self-closing output enabled it appears as <name/>.

How are arrays represented?

Each array item becomes a repeated sibling element. For example, "tag":["a","b"] becomes two <tag> elements.

Is XML-to-JSON perfectly reversible?

No. Mixed content, comments, CDATA boundaries, namespace declarations and the distinction between one element and an array can be represented differently after conversion. Review round trips carefully.

What about XML namespaces?

Existing namespace-qualified XML can be read in reverse mode, with qualified names retained. Forward conversion accepts colons in names but does not invent namespace declarations; include valid declaration attributes in the JSON when needed.