JSON

JSON to XML Converter

Convert JSON data to well-formed XML instantly — free, private, and right in your browser.

Your JSON is parsed and converted locally in your browser. No data is uploaded to any server.

1
Paste JSON here...

0 characters

XML result will appear here...

0 characters

How to use

  1. Paste your JSON into the left panel (or click Load sample to try it out).
  2. Choose your options: pretty print, root element name, self-closing empty tags.
  3. Click Convert JSON to XML.
  4. Copy the XML or download it as an .xml file.

How JSON maps to XML

JSON has no notion of tags or attributes, so converting it to XML requires a set of mapping rules. This tool produces clean, well-formed XML with an XML declaration, proper escaping of &, <, >, and quoted attribute values.

Supported JSON features:

  • Objects — become XML elements with child elements
  • Arrays — become repeated elements with the same tag name
  • Strings — escaped text content
  • Numbers and booleans — serialized as text content
  • Null — empty elements (self-closing when the option is enabled)
  • Nested objects — nested elements to any depth
  • @key properties — converted back to XML attributes

If your JSON object has exactly one top-level key, that key becomes the root element; otherwise the document is wrapped in your chosen root element (default root). Top-level arrays place each item in an <item> element inside the root.

Need to convert XML into JSON? Use the XML to JSON Converter →

Examples

Simple object

{"name": "John", "age": 30} wrapped in a root element becomes <root><name>John</name><age>30</age></root>.

Single top-level key

{"person": {"name": "John"}} uses the key itself as the root: <person><name>John</name></person> — no extra wrapper.

Arrays as repeated elements

{"tags": ["a", "b"]} becomes <tags>a</tags><tags>b</tags> — the standard XML way of representing lists.

Round-trip with attributes

Keys starting with @ become attributes: {"user": {"@id": "42"}} produces <user id="42"></user>, which round-trips cleanly with the XML to JSON converter.

Frequently Asked Questions

What is JSON to XML conversion?+
It is the process of translating JSON values into an equivalent XML document: object keys become element tags, values become text content or child elements, and arrays become repeated elements.
How do I convert JSON to XML?+
Paste your JSON into the input panel, click Convert JSON to XML, then copy or download the result. You can set a custom root element and toggle self-closing empty tags.
Is this JSON to XML converter free?+
Yes — completely free, with no registration, no usage limits, and no watermarks.
Is my JSON uploaded to a server?+
No. Conversion runs entirely in your browser using built-in JavaScript APIs. Nothing is logged or stored.
How are JSON arrays represented in XML?+
XML has no native array type, so array items become repeated sibling elements sharing the parent key as their tag name. Top-level arrays use <item> elements inside the root.
What happens to null values?+
Null becomes an empty element. Enable "Self-closing empty tags" to output <tag /> instead of <tag></tag>.
Is the output guaranteed to be well-formed XML?+
Yes — the XML is produced by serializing structured values with proper escaping, never by string concatenation of raw input. You can double-check it with the XML Validator or pretty-print it with the XML Formatter.

Related Tools

Looking for something else? Browse all tools