Convert JSON to XML Converter

Online converter • Max file size: 100 MB • Nothing is stored on the server

Free plan: 6 / 6 conversions left today • 100 MB limit Unlimited and 500 MB uploads with a customer account.
1

Drop your file here or browse

Max 100 MB • Supported formats depend on converter

or paste text directly
2

No additional options for this converter.

Convert JSON to XML online in a single click. Paste your JSON, press Convert, and get clean, well-formed, indented XML you can copy or download instantly. Need the reverse? Use Swap and the tool works as an XML to JSON converter too. It runs in your browser, needs no signup, and your data is never stored.

What Is a JSON to XML Converter?

JSON (JavaScript Object Notation) stores data as key/value pairs and arrays. XML (Extensible Markup Language) stores data inside nested tags with attributes. Modern apps and REST APIs speak JSON, but many enterprise systems, SOAP services, RSS feeds, sitemaps and configuration files still require XML.

A JSON to XML converter bridges the two: objects become elements, arrays become repeated elements, and values become text nodes, so you can feed JSON data into any XML-based system without writing the markup by hand.

How to Convert JSON to XML Online

  1. Paste your JSON into the input box, or upload a .json file.
  2. Click “Convert”. The tool validates your JSON first and points to the exact line of any syntax error.
  3. Copy or download the formatted XML.
  4. Need JSON again? Press “Swap” to use the XML to JSON converter.

Quick example

JSON input XML output
{
  "order": {
    "@id": "101",
    "customer": "Anna",
    "item": ["Shirt", "Cap"]
  }
}
<order id="101">
  <customer>Anna</customer>
  <item>Shirt</item>
  <item>Cap</item>
</order>

How JSON Maps to XML

JSON XML result
Object { } Nested element
Array [ ] Repeated sibling elements
Key starting with @ Attribute
#text key Text content of an element with attributes
String, number, boolean Text node
null Empty element
Invalid tag characters in a key Sanitized to a valid XML name

Key Features

  • Fast and free: instant conversion, no limits, no account.
  • Valid output: special characters are escaped (&amp;, &lt;, &gt;) so the XML is well-formed.
  • Arrays handled: every array item becomes its own element.
  • Attribute support: use the @ prefix to create XML attributes.
  • Custom root element: choose the root tag name and the XML declaration.
  • Pretty print or minify: readable output, or compact output for production.
  • Two-way: JSON to XML and XML to JSON in one tool.
  • Private: conversion happens in your browser.

Why Convert JSON to XML?

  • Legacy and enterprise systems: many ERPs, banking and government services only accept XML.
  • SOAP web services: SOAP requests are XML envelopes.
  • Feeds and sitemaps: RSS, Atom and XML sitemaps are XML by definition.
  • Validation: XML supports XSD schemas and XSLT transforms for strict data contracts.
  • Configuration files: Android, Maven, .NET and many tools use XML configs.

JSON vs XML: Quick Comparison

Feature JSON XML
Syntax Key/value pairs and arrays Tags and attributes
File size Smaller Larger
Data types String, number, boolean, null, object, array Everything is text
Comments Not supported Supported
Schemas JSON Schema XSD, DTD
Best for REST APIs, web and mobile apps SOAP, feeds, documents, config

Convert JSON to XML in Code

JavaScript (Node.js)

import { XMLBuilder } from "fast-xml-parser";
const builder = new XMLBuilder({ format: true, attributeNamePrefix: "@", ignoreAttributes: false });
const xml = builder.build(JSON.parse(jsonString));

Python

import json, xmltodict
xml = xmltodict.unparse(json.loads(json_string), pretty=True)

PHP

$data = json_decode($json, true);
$xml = new SimpleXMLElement('<root/>');
array_walk_recursive($data, function ($v, $k) use ($xml) { $xml->addChild($k, $v); });
echo $xml->asXML();

For nested data and attributes the online tool above is quicker, and you can check the result with our XML Beautifier.

Tips for Accurate JSON to XML Conversion

  • Make sure your JSON is valid: double quotes, no trailing commas, matching brackets.
  • XML needs a single root element. If your JSON has several top-level keys, the tool wraps them in a root you can rename.
  • XML element names cannot start with a number or contain spaces. Rename such keys first.
  • Use @ keys for attributes to keep your XML compact.
  • JSON numbers and booleans become plain text in XML, so define types in an XSD if the receiver needs them.

Related Free Tools

Keep working with your data using more free tools from athemeart.com/tools:

Learn more: W3C XML specification · JSON.org · MDN: JSON

Frequently Asked Questions

How do I convert JSON to XML online?

Paste your JSON into the tool and click Convert. The XML appears instantly and you can copy or download it.

Is this JSON to XML converter free?

Yes. It is completely free, with no signup and no usage limit.

Can I convert XML to JSON too?

Yes. Press Swap to use the XML to JSON converter, or open the dedicated XML to JSON Converter.

How are JSON arrays converted to XML?

Each array item becomes a repeated XML element using the array’s key as the tag name.

How do I create XML attributes from JSON?

Prefix the key with @. For example, "@id": "101" becomes id="101" on the parent element.

How do I convert JSON to PDF?

PDF is a document format, so JSON has to be formatted first. Beautify the JSON (or convert it to XML and style it), open it in a browser or editor, then use Print and choose Save as PDF. To go the other way and extract data from a PDF, use our PDF to JSON Converter.

Is my data safe?

Conversion runs in your browser. Your JSON and XML are not stored on our servers.

Why does my JSON fail to convert?

Usually the JSON is invalid: a missing quote, a trailing comma or an unclosed bracket. The error message shows the line to fix.