JSON to XML Converter Online

Local only

Parse JSON and create readable XML with deterministic element, array, attribute, and text mapping rules.

55 chars · 1 line

Waiting for input

Loading XML parser…

JSON to XML conversion guide

How to convert JSON to XML online

Paste valid JSON into the converter above to create a readable XML document. A single top-level object key becomes the root element, arrays become repeated child elements, and the @attributes and #text conventions can recreate structures produced by the XML-to-JSON direction. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • Standard JSON parsing before conversion
  • Single-key root element mapping
  • JSON arrays to repeated XML elements
  • @attributes and #text conventions
  • .xml result downloads
  • Browser-local processing

Steps

  1. Paste a valid JSON object, array, or primitive value.
  2. Keep JSON → XML selected in the toolbar.
  3. Correct any JSON syntax or invalid XML-name error reported by the converter.
  4. Copy the XML result or download it as a .xml file.

JSON must parse before XML is created

The converter first uses standard JSON parsing. Comments, trailing commas, undefined, and other non-JSON syntax must be corrected before element creation begins.

When the top-level JSON object contains exactly one key, that key becomes the XML root element. Other top-level values use a root wrapper.

Arrays become repeated XML elements

An array stored under a property creates repeated sibling elements with that property name. A top-level array becomes repeated item elements under the generated root wrapper.

  • Use ordinary object keys for XML element names.
  • Use @attributes to set attributes on the current element.
  • Use #text when an element needs text alongside attributes or children.

Review XML names and type expectations

JSON keys are more permissive than XML names. Invalid element or attribute names are reported rather than silently rewritten, and XML text does not preserve JavaScript number or boolean types without a separate schema.

JSON to XML example

An object containing a repeated port array becomes nested XML with repeated port elements.

JSON input

{"service":{"name":"api","ports":{"port":[8080,8081]}}}

XML output

<service>
  <name>api</name>
  <ports>
    <port>8080</port>
    <port>8081</port>
  </ports>
</service>

Common questions

Frequently asked questions

How is the XML root element chosen?

A JSON object with exactly one top-level key uses that key as the root element; other top-level values use a root wrapper.

How are JSON arrays converted to XML?

Arrays under a property become repeated elements with that property name, while top-level arrays use repeated item elements.

What happens when a JSON key is not a valid XML name?

The converter reports the invalid name instead of silently changing the source key.

Debugging a specific XML issue? Browse XML troubleshooting.