🏷️ JSON to XML — Free & Instant

Convert JSON to XML Online

Transform JSON objects and arrays into well-formed XML. Custom root and record element names, pretty print, XML declaration, and attribute support with @ prefix keys.

Custom element namesPretty printXML declarationAttribute support100% private
JSON Input
📁

Drop JSON file here

XML Output
Elements: Size:

Frequently Asked Questions

How do I convert JSON to XML?

Paste JSON, set root and item tag names, choose indent size, and click Convert to XML. Download or copy the result.

How are JSON arrays converted?

Each array item is wrapped in the Item tag (default: item) inside the Root tag. Nested objects become child elements.

What does "@ keys as attrs" do?

When enabled, JSON keys starting with @ become XML attributes. For example, {"@id":"1","name":"Alice"} produces <item id="1"><name>Alice</name></item>.

Is the output valid XML?

Yes. All values are XML-escaped, element names are sanitized (spaces replaced with underscores, invalid start characters prefixed), and the document is well-formed XML 1.0.

JSON to XML — Complete Guide

XML (Extensible Markup Language) remains essential in enterprise integrations, SOAP web services, configuration files (Maven, Android manifests), and document formats (DOCX, XLSX are ZIP archives of XML). Converting JSON to XML is a common need when integrating modern REST APIs with legacy XML systems.

JSON vs XML Structure

JSON:                          XML:
{"name":"Alice","age":30}  →  <item><name>Alice</name><age>30</age></item>

Handling Arrays

JSON arrays map to repeated XML elements. Each array item gets the item tag you specify. Nested arrays are recursively converted.

Using Attributes

XML attributes are more compact than child elements for simple scalar values. Enable @ keys as attrs to map JSON keys prefixed with @ to XML attributes — following the popular BadgerFish and Abdera conventions.