Skip to main content

Data Tools

JSON to XML

Convert JSON data to XML format. Free online tool — runs in your browser, no sign-up required.

See how to use this tool

JSON to XML

Data is converted locally in your browser without server upload.

Privacy: your input is processed only in this browser. Refreshing clears the current state.

About JSON to XML

ToolConv's JSON-to-XML converter transforms a JSON document into a valid XML tree in your browser, mapping object properties to child elements and array items to repeated elements. Special handling deals with JSON keys that aren't valid XML tag names — they're sanitized or wrapped in attributes — and CDATA sections are used for values containing angle brackets or other markup.

Everything runs locally, so API configs, SOAP request bodies, and legacy-system payloads never leave your device. You can set a custom root element name, choose pretty-print vs. compact output, and control whether arrays are wrapped in a container element.

How to use it

  1. 1Paste JSON or drop in a .json file.
  2. 2Set a root element name (default: root).
  3. 3Choose pretty-print or compact output.
  4. 4Toggle 'wrap arrays in a container element' if needed.
  5. 5Click Convert and download the .xml.

When to use it

  • ✓Building a SOAP request body from a JSON config in an integration project.
  • ✓Converting an API response to XML for a legacy system that only accepts XML.
  • ✓Generating an XML sitemap-like structure from JSON data.
  • ✓Producing XML config files for tools that require XML input.

Features

  • •Object-to-element and array-to-repeated-element mapping.
  • •Sanitizes invalid XML tag names and uses CDATA for markup values.
  • •Custom root element name and pretty/compact output.
  • •Optional array container wrapping for stricter XML schemas.

Related tools

FAQ

How are JSON arrays converted to XML?

Each item in a JSON array becomes a repeated element with the array's key as the tag name. Optionally enable 'wrap arrays in a container' to surround the repeated items with a parent element for stricter schemas.

What happens to JSON keys that aren't valid XML tag names?

Keys starting with a number or containing spaces/special characters are sanitized — invalid leading characters are escaped and special characters replaced with underscores — so the output stays valid XML.

Is my JSON uploaded?

No. Conversion runs entirely in your browser; API configs and request bodies never leave your device.

Does it preserve attribute vs. element distinction?

JSON has no native attribute concept, so all properties become elements by default. Use a naming convention like @attr for keys you want as attributes and the converter will promote them.

How are null values handled?

null becomes an empty element (<tag></tag>) or a self-closing element (<tag/>), depending on the output mode you choose. Empty strings also render as empty elements.

Will the output XML be valid?

Yes — the converter always produces well-formed XML with a single root, properly closed tags, and escaped/CDATA-wrapped special characters. Validate it with xml-formatter if you want a second check.