JSON to XML Converter

Convert JSON objects, arrays, and values into typed XML for data exchange, integrations, and applications that support this mapping.

Use a letter or underscore first, followed by letters, numbers, dots, hyphens or underscores. Names beginning with XML are reserved.

Input JSON

0 characters

XML output

Your XML output will appear here.

Paste JSON or open a file to begin.

XML mapping and type preservation

Every element has a type attribute: object properties use <property name="...">, and ordered array entries use <item>. Types distinguish strings, numbers, booleans, null, objects and arrays; empty collections remain distinct. Keys are stored as escaped attribute values, so arbitrary JSON keys do not need XML-safe names. The configured root element contains the root value directly. XML 1.0-invalid characters are rejected. Browsers exposing JSON source text preserve numeric lexemes; older browsers parse through JavaScript numbers and reject unsafe or non-finite values. Decimal precision on those browsers follows JavaScript number semantics.

This is a documented typed mapping, not a general XML-to-JSON converter. Arbitrary XML has no unique JSON representation.

Convert JSON to XML with an explicit type mapping

Use this JSON to XML converter when a service or workflow needs XML instead of JSON. Because JSON and XML organize data differently, the converter uses a documented mapping: objects become nested property elements, array entries become ordered item elements, and every element carries a type attribute.

Paste valid JSON or open a local .json file. Choose a root element name, indentation, and whether to include an XML declaration. The converter checks the generated document with the browser's XML parser before enabling Copy and Download.

Example: JSON object converted to XML

With the default root name, this JSON:

{
  "name": "Catalog",
  "enabled": true,
  "retries": 3
}

becomes typed XML:

<?xml version="1.0" encoding="UTF-8"?>
<root type="object">
  <property name="name" type="string">Catalog</property>
  <property name="enabled" type="boolean">true</property>
  <property name="retries" type="number">3</property>
</root>

The type attributes keep values such as the string "3" distinct from the number 3. JSON keys are stored in the name attribute, so keys do not have to be valid XML element names.

How to convert JSON to XML

  1. Paste JSON into the input area, choose Open JSON, or drop a JSON file into the input panel. The file limit is 50 MiB.
  2. Set a root element name. It must start with a letter or underscore; later characters may include letters, numbers, dots, hyphens, or underscores. Names beginning with xml are reserved.
  3. Choose two- or four-space indentation, and select whether to pretty print and include the XML declaration.
  4. Select Convert to XML. Check the status and the displayed root type and output size.
  5. Copy the XML or download it as converted.xml.

How JSON values are represented

Text and attribute values are escaped for XML. Characters that XML 1.0 does not allow cause conversion to stop with an error instead of producing an invalid document.

This mapping is not an application-specific XML schema

The output is well-formed typed XML, but it is not automatically a SOAP message, RSS feed, configuration vocabulary, or XML document for a particular API. Some systems require exact element names, attributes, namespaces, ordering, or an XML Schema. Adapt the output to that contract and validate it with the receiving application before using it.

The converter checks that a browser can parse the generated XML. Well-formedness means the tags and document structure are valid XML; it does not mean the content matches a system's schema or business rules.

Numbers and browser compatibility

Some browsers expose the original text of JSON numbers to the converter, allowing the XML output to retain their numeric spelling. If a browser cannot preserve an integer outside JavaScript's safe range, the converter rejects it rather than silently writing a rounded value. Decimal precision on those browsers follows JavaScript number behavior. For identifiers, consider storing digits as a JSON string when the consuming system expects text.

Where is the JSON processed?

The converter reads the pasted text or selected file in your browser and uses the browser's built-in XML parser to check the output. The conversion script does not send the JSON to a server. Avoid entering credentials or confidential records into any website unless you trust its data handling.

JSON to XML and related tools

Use the JSON Validator to check JSON syntax before conversion, or the JSON Editor to change the source data. The JSON to YAML Converter is useful when the receiving system expects YAML. Choose the target format required by the application that will read the data.

Frequently asked questions

Can I convert nested JSON objects and arrays?

Yes. Nested objects become nested property elements, and arrays become ordered item elements.

Why does the output include a root element?

XML needs one document element. The converter wraps the top-level JSON value in the root name you choose, which defaults to root.

Can I use the result with any XML application?

Not necessarily. The result uses this converter's typed mapping. Check the receiving application's required element names, namespaces, schema, and version.

Does the converter check my XML schema?

No. It parses the generated document to check that it is well-formed XML. Schema validation must be done against the rules for the target system.

Can JSON be converted back from this XML?

A converter that understands these type, property, and item conventions can reconstruct the corresponding JSON structure. Arbitrary XML does not have one universally correct JSON representation.

Does the converter preserve large numbers?

It preserves numeric text when the browser exposes the original JSON number token. In browsers without that support, unsafe integers are rejected to avoid silent rounding. Review precision-sensitive decimals as well.

Can I change the root element and formatting?

Yes. Enter a valid root name, select two or four spaces, and toggle pretty printing or the XML declaration. Changing an option clears the old output until you convert again.

Is my JSON uploaded?

The conversion script processes your JSON in the browser and does not send the document to a server. Do not paste sensitive data into a website unless you are comfortable with its data handling.