Skip to content
Toolspire

Developer Tools

JSON to XML Converter

JSON to XML Converter is part of Toolspire and is ready as soon as this page loads. Turn JSON into clean, valid XML — attributes from “@” keys, repeated or wrapped arrays, CDATA and your own root element. Converts as you type, entirely in this tab.

Runs in this tabFreeNo account

On this page

What you can do here

Attributes and text

Write {"price": {"@currency": "INR", "#text": "799"}} and get <price currency="INR">799</price> — exactly what most XML APIs expect.

Your array style

Repeat the element for each entry, or wrap entries in item elements — whichever the receiving system wants.

Always valid XML

Invalid names are fixed, special characters escaped, mixed content kept on one line and empty arrays handled, with a note for every change.

Round-trips

Switch to XML → JSON at any time: the result converts straight back, so you can edit data as JSON and send it as XML.

Exact numbers

IDs and amounts like 12345678901234567890 or 1.50 are written exactly as in the JSON, never rounded.

Private

API payloads and configs stay on your device. No upload, no account.

The sequence

How to convert JSON to XML

  1. 1

    Paste the JSON

    Paste JSON into the left box, open a .json file, or try the Sample.

  2. 2

    Set the options

    Open Options to choose the root and item element names, how arrays are written, CDATA and the XML declaration.

  3. 3

    Check the result

    The XML appears as you type, with notes about anything that was renamed, wrapped or removed.

  4. 4

    Copy or download

    Click Copy, or Download to save an .xml file.

Worth knowing

  • JSON to XML Converter on Toolspire: keys starting with @ become attributes and #text becomes element text — the same convention as the XML to JSON converter, so data round-trips.
  • Arrays can repeat the element (<tag>a</tag><tag>b</tag>) or wrap each item (<tags><item>a</item>…</tags>), and nested arrays always produce valid XML.
  • Data without a single root is wrapped in a root element you can name; top-level arrays get one item element per entry.
  • Keys that aren’t valid XML names are fixed (“first name” → first_name, “2nd” → _2nd) and listed, and characters XML can’t hold are removed and reported.
  • Options for the XML declaration, CDATA sections, self-closing empty elements and 2-space, 4-space, tab or minified output.
  • Accepts relaxed JSON (comments, trailing commas, single quotes) and points to the exact line and column of real errors. Big numbers keep every digit.
  • Runs entirely in this tab — the JSON is not sent to us.

How JSON maps to XML

JSONXML
{"user": {"name": "Asha"}}<user><name>Asha</name></user>
{"user": {"@id": "7"}}<user id="7"/>
{"price": {"@currency": "INR", "#text": 799}}<price currency="INR">799</price>
{"list": {"tag": ["a", "b"]}}<list><tag>a</tag><tag>b</tag></list> (or wrapped: <list><tag><item>a</item><item>b</item></tag></list>)
{"note": null}<note/>
[1, 2]<root><item>1</item><item>2</item></root>

Good to know

XML has no data types, so numbers, booleans and null all become text: true is written as <paid>true</paid>. An empty array can’t be shown with repeated elements, so it is left out (with a note) unless you choose Wrap items.

Converting the other way? Use the XML to JSON converter. To check or tidy JSON first, try the JSON Formatter.

FAQ

Questions about JSON to XML Converter

Where does JSON to XML Converter run?

JSON to XML Converter runs in this tab on Toolspire. What you type or drop in is not sent to us and is not stored on a server.

How do I convert JSON to XML?

Paste your JSON into the box. The XML appears on the right straight away — copy it or download it as an .xml file.

How do I make an XML attribute from JSON?

Start the key with @. For example {"book": {"@id": "42", "title": "Gitanjali"}} becomes <book id="42"><title>Gitanjali</title></book>. You can change the prefix under Options.

How are JSON arrays converted?

By default each entry repeats the element: "tag": ["a","b"] gives two <tag> elements. Choose Wrap items to get <tag><item>a</item><item>b</item></tag> instead, and set the item element’s name.

Why was my data wrapped in <root>?

An XML document must have exactly one top-level element. If your JSON has several top-level keys, or is an array, it’s wrapped in a root element — you can rename it under Options.

Can it convert invalid JSON?

It accepts common slips — comments, trailing commas, single quotes and unquoted keys — and tells you what it fixed. For real errors it shows the line and column so you can correct them.

Is my JSON uploaded?

No. The conversion runs in this tab, so API responses, keys and customer data stay on this device.

Keep going

Open the full directory

Last updated Report a problem or suggest a feature