DockittDockitt

JSON to XML Converter — Free Online Tool

Convert JSON to XML format online. Wraps in a root element, handles arrays and nested objects. Free, browser-based.

Runs entirely in your browser — no data leaves your device
No account, no signup, completely free
Instant results — no waiting for server processing
Works offline once the page is loaded
Runs entirely in your browser. Your text never leaves your device — no server, complete privacy.

JSON is the preferred format for modern web APIs, but many enterprise systems, legacy applications, and SOAP-based services require XML. This tool converts a JSON object or array to a valid XML document, wrapping the output in a configurable root element name. Arrays become repeated XML elements with the same tag. Nested objects become nested elements. All values are encoded to ensure valid XML output.

How to use

  1. Paste your JSON object or array into the input textarea.
  2. Click 'Convert to XML' to generate the XML document.
  3. Copy the XML to clipboard or download it as a .xml file.

FAQ

What root element name is used for the output XML?

The output XML is wrapped in a <root> element by default. This is necessary because XML requires exactly one root element. If your JSON is an object with a single top-level key, that key becomes the root element name. For arrays, the items are wrapped in <item> elements inside the <root> element.

How are JSON arrays converted to XML?

JSON arrays are converted to repeated XML elements. For example, {"items": ["a", "b", "c"]} becomes <items><item>a</item><item>b</item><item>c</item></items>. If the JSON root is an array, each element becomes an <item> element inside the <root> wrapper.

How are JSON keys that are invalid XML element names handled?

XML element names cannot start with a number or contain spaces or special characters. If a JSON key would produce an invalid XML element name (e.g., '1key' or 'my key'), the converter prefixes it with 'key_' or replaces spaces with underscores to produce a valid XML element name.

Are null values included in the XML output?

JSON null values are represented as empty XML elements. For example, {"name": null} becomes <name/>. This preserves the presence of the field in the output while correctly representing the absence of a value.

Does the output include an XML declaration?

Yes. The output includes the standard XML declaration <?xml version='1.0' encoding='UTF-8'?> at the top. The encoding is always UTF-8, which is the standard encoding for XML documents and matches the Unicode content that JavaScript strings produce.

Is the conversion done in my browser or on a server?

The conversion runs entirely in your browser using pure JavaScript string manipulation. No data is sent to any server. This makes the tool safe for converting API responses, configuration data, or any other sensitive JSON content.