Free No sign-up Client-side

JSON to XML Converter

Turn a JSON object into well-formed, indented XML in one step — keys become element names, nesting becomes a tag tree, and the result is ready to drop into a SOAP body or config file.

InputXML
Output
Input: 0 lines · 0 charsOutput: 0 lines · 0 chars Processed locally in your browser

What this converter actually does

This tool reads your JSON, then walks the object and writes an equivalent XML document where every property name turns into a tag and every nested object or array becomes a nested set of elements. A property like {"title": "Hello"} comes out as <title>Hello</title>, and an array produces a repeated element for each item.

Conversion uses the compact mapping with four-space indentation, so the XML you get back is already pretty-printed rather than crammed onto one line. That makes it easy to paste straight into a request body, an Android resource file, or any system that still speaks XML rather than JSON.

Because JSON has no concept of attributes or a single mandatory root, the output mirrors your object's shape directly. If your JSON has several top-level keys, you'll see each as its own element — wrap them in one outer object first if a strict single-root document is required.

Convert JSON to XML in three moves

  1. 1

    Paste or load JSON

    Drop your JSON into the left pane, or hit Load sample to see a worked example first.

  2. 2

    Read the XML

    The right pane fills in automatically with indented, well-formed XML the moment your JSON parses cleanly.

  3. 3

    Copy or save

    Use the copy button for a quick paste, or download the result as a .xml file for your project.

When developers reach for it

Feeding SOAP services

Modern apps speak JSON, but plenty of enterprise endpoints still expect an XML payload. This bridges the two without hand-writing tags.

Generating config files

Build your settings as a JSON object, then emit the XML form that a legacy framework or build tool reads.

Quick structural sanity check

Seeing your data as a tag tree often makes a nesting mistake jump out faster than scanning braces.

Nothing leaves the tab

Conversion happens in JavaScript on your machine, so internal payloads stay internal.

A worked example

A small JSON object on the left, the generated XML on the right.

JSON object → XML tree
{
  "book": {
    "title": "Refactoring",
    "year": 1999,
    "tags": ["code", "design"]
  }
}
<book>
    <title>Refactoring</title>
    <year>1999</year>
    <tags>code</tags>
    <tags>design</tags>
</book>

How JSON shapes map to XML

  • Objects become parent elements; their keys become child element names.
  • Arrays become a sequence of repeated elements that share the array's key as their tag name.
  • Strings, numbers, booleans and null become the text content of their element.
  • Deeply nested objects produce correspondingly nested tags — the hierarchy is preserved exactly.

Things XML can express that JSON can't

XML supports attributes, namespaces, comments and processing instructions, none of which exist in plain JSON. A straight conversion therefore renders everything as elements and text. If you specifically need attributes (for example <item id="1"/>), you'll typically adjust the XML by hand after conversion, since there's no unambiguous JSON convention for them.

Frequently asked questions

Either works. A single object converts to a matching element tree; an array of items converts to repeated elements. Just make sure the input is valid JSON first.

JSON arrays are positional and unnamed, so each element is emitted under the array's key. That's the standard compact mapping — three items under a 'tags' array become three 'tags' elements.

Not automatically. JSON has no attribute concept, so everything maps to elements and text. If you need attributes, add them to the generated XML afterward.

Only if your JSON itself has a single top-level key. Multiple top-level keys produce multiple sibling elements; wrap them in one outer object if your consumer requires exactly one root.

No. It runs as JavaScript in your browser, so your data never leaves the page. You can even work offline once the tool has loaded.

Use our XML to JSON converter. It parses XML and rebuilds the equivalent JSON structure so you can move data in both directions.

Need another tool?

Browse the full toolbox or dig into the blog for the engineering behind it.

Call UsWhatsApp