JSON Tools

JSON to XML

Generate an XML document from a JSON value. Object keys become element names, arrays repeat elements, text is escaped, and the result includes an XML declaration and a root element.

✓ Every tool runs in your browser. We do not upload your input or output.

JSON to XML
Keyboard shortcuts

Ctrl/⌘ + Enter: process

Ctrl/⌘ + Shift + F: full screen

Esc: exit full screen

Ctrl/⌘ + F in editor: search

XML output
ReadyLines: 1 · Characters: 0 · Size: 0 KB · Time: — · Cursor: 1:1

How to use

  1. Paste valid JSON, upload a file, or load the sample data.
  2. Inspect the XML output, including the generated root wrapper and repeated tags for array items.
  3. Check element names if source keys contain punctuation; unsupported characters are replaced with underscores.
  4. Copy or download the .xml file and validate it against any schema required by your destination.

Examples

Convert a customer record

Object keys become nested elements below the root wrapper.

Input
{"customer":{"id":5,"name":"Avery"}}
Output
<root>
  <customer>
    <id>5</id>
    <name>Avery</name>
  </customer>
</root>

Escape text safely

Reserved XML characters are escaped so the output remains well formed.

Input
{"message":"A & B < C"}
Output
<message>A &amp; B &lt; C</message>

A clear, generic mapping

There is no single universal mapping between JSON and XML. This tool chooses a simple element-based representation: object keys become tags, nested objects become nested tags, arrays repeat the same tag, and null values become empty elements. A root wrapper gives object inputs one outer element, which is required for a complete XML document.

Text is escaped for XML’s reserved characters. This matters when a value contains an ampersand, angle bracket, quote, or apostrophe. Without escaping, the result could be malformed or interpreted as markup. Source keys are normalized into safe element names; if the exact original key spelling is important, inspect the output before using it.

Know the limits of generic conversion

XML has namespaces, attributes, mixed content, and schemas that JSON does not describe. This converter cannot infer those structures from a plain object. It is suitable for quick exports, examples, and simple integrations. For a strict XML API, validate the result against that API’s schema and adjust the mapping to its expected element names and attributes. For a root array, the tool creates item elements under root. Wrap the array in a named object first if your destination requires a specific element name.

Frequently asked questions

How are arrays represented?

Each array item becomes a repeated element with the same tag name. A root array is wrapped in one root element containing item elements.

Are JSON types preserved in XML?

XML text does not carry JSON type information by default. Numbers and booleans become text and should be interpreted by your consuming schema.

What happens to invalid XML element names?

Unsupported characters are replaced with underscores, and names that cannot start an element receive a safe prefix.

Does the tool generate attributes?

No. JSON properties become elements. Add attributes manually or use a schema-specific converter when attributes are required.

Related tools