Skip to content

JSON to XML

Convert JSON into XML, with control over attributes, arrays and the root element.

Quick Tool Overview

The JSON to XML converter turns object keys into elements, @-prefixed keys into attributes, and arrays into repeated elements or wrapped lists. Reserved characters are escaped and unsafe element names are made valid.

What it does
Converts JSON into XML with configurable conventions
You give it
A JSON object or array
You get back
Escaped, indented XML with a single root element
Best for
Feeding legacy APIs, product feeds and XML uploads
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the JSON to XML

JSON and XML do not map onto each other cleanly, so this converter makes the awkward parts explicit rather than guessing. Object keys become elements. Keys beginning with the attribute prefix — @ by default — become attributes on the parent element instead.

Arrays are the real decision. By default each item repeats the parent key, which is how XML has always spelled a collection: three <tag> elements rather than a list. There is also a wrapped mode that puts the items inside a container element, which some schemas require. A JSON array at the root gets a wrapper automatically, because XML permits exactly one root element. Reserved characters in text and attribute values are escaped, and invalid element names are made safe.

Key features of the JSON to XML

Attributes, not just elements

A key prefixed with @ becomes an attribute on the parent element, which is the only way to hit a schema that expects one.

Two array conventions

Repeat the key per item, which is how XML has always spelled a collection, or wrap the items in a container element.

Element names made valid

Spaces and punctuation become underscores and a leading digit gets a prefix, because XML forbids both.

Correct escaping

Ampersands and angle brackets in text, and quotes in attribute values, are escaped — the usual cause of a rejected upload.

Arrays at the root are handled

XML allows exactly one root element, so a top-level array is wrapped in the root name you choose rather than failing.

How to use the JSON to XML

  1. 1

    Paste your JSON

    An object or an array; both are handled.

  2. 2

    Name the root element

    Used when your JSON does not already have a single named wrapper.

  3. 3

    Choose how arrays are written

    Repeat the key for each item, or wrap the items in a container element.

  4. 4

    Copy or download

    Take the XML to your clipboard or save it as an .xml file.

Frequently asked questions

Prefix the JSON key with @. The key "@id" becomes an id attribute on the parent element instead of a child element called id.

Reviews of the JSON to XML

What people who use the JSON to XML think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the JSON to XML. It takes half a minute and no account.

Write the first review

More developer tools