JSON to XML

Produce XML from JSON for systems that still expect it, such as SOAP services, feeds or legacy imports. Object keys become elements, arrays repeat the element, keys with an attribute prefix become attributes, and special characters are escaped so the result is always well-formed.

Data Formats Runs in your browser

Convert JSON to XML

Used for top-level and nested arrays.
Keys starting with this become attributes.

How to Use the JSON to XML

  1. Paste the JSON.
  2. Set the root element, the item name for arrays and the attribute prefix.
  3. Press Convert.
  4. Copy or download the XML and check the notes for renamed keys.

About This Tool

Developers integrating with XML-only systems, testers building XML fixtures, and anyone converting data between formats.

Input: JSON  ·  Output: XML (.xml).

Features and Limitations

Features

  • Always well-formed: &, <, > and quotes are escaped.
  • Attributes from @-prefixed keys and element text from #text, matching the XML to JSON tool.
  • Keys that are not valid XML names are fixed and reported.
  • Configurable indentation and declaration.

Limitations

  • XML has no types, so numbers, booleans and null become text or empty elements.
  • Empty arrays produce one empty element.
  • Characters not allowed in XML 1.0 (most control characters) are removed.
  • Results are computed in your browser; nothing you enter is sent to a server.

Example

{"book":{"@id":"b1","title":"XML"}} with root “catalog” becomes <catalog><book id="b1"><title>XML</title></book></catalog> (indented).

Frequently Asked Questions

How do I create attributes?

Prefix the key with @ (or the prefix you set), for example {"@id": "b1"}.

What happens to arrays?

An array under a key repeats that element for each item. Top-level arrays and arrays inside arrays use the item element name.

What if a key is not a valid XML name?

Invalid characters are replaced with _ and names that start with a digit get a leading _. Every change is listed in the notes.

Is my data uploaded?

No. The conversion runs in your browser.

Related Tools

More like this: all Data Formats tools, all Developer & Web tools or the TinySandy home page.