Input JSON

Output XML

What Is JSON to XML?

XML (eXtensible Markup Language) and JSON are both used for structured data. XML uses tags and attributes; JSON uses keys and values. Converting JSON to XML means turning objects into elements, properties into child elements or attributes, and arrays into repeated elements. Some legacy systems, SOAP APIs, and config formats expect XML. This tool produces XML from your JSON.

Conversion runs in your browser. You can set a root element name and choose whether to include the XML declaration. Nothing is sent to a server.

How to Use This Tool

1

Paste JSON

Paste your JSON into the left editor or upload a file. Use Sample for example data. Click the settings icon to set the root element name and XML declaration.

2

Review XML Output

The right panel shows the generated XML. Object keys become element names; values become text content. Arrays produce repeated elements. The XML spec defines the format.

3

Download or Copy

Use Download or Copy to get the XML. For the reverse conversion, use XML to JSON. For formatting JSON first, use the JSON Formatter.

JSON to XML Examples

Here is an example of converting JSON to XML.

Example: Subscriber record

JSON input:

Input

Generated XML output:

Output

JSON vs XML

JSON is simpler and more compact; XML supports namespaces, attributes, and mixed content. The conversion maps JSON objects to XML elements. There's no single standard mapping; different tools make different choices. This tool uses a common approach: objects become nested elements, arrays become repeated elements. For more control, you might need a library like xml-js or custom code.

Frequently Asked Questions

Are XML special characters escaped?

Yes. Characters like <, >, and & are escaped in text content per the XML spec.

What about invalid XML element names?

JSON keys can contain characters that XML element names cannot (e.g. spaces, numbers at the start). The converter typically sanitizes or prefixes such keys. Check the output.

Is my data sent anywhere?

No. Conversion runs in your browser.

Can I convert XML back to JSON?

Yes. Use the XML to JSON tool on this site.

What's the root element?

XML needs a single root element. The settings let you choose the name (default "root"). The JSON object becomes the content of that element.

Related Tools

XML is defined by the W3C. For JSON, see json.org and MDN.