JSON to XML
This JSON to XML converter turns JSON data into well-formed, indented XML with a declaration. Both the root element name and the array item tag name are configurable, and arrays are emitted as repeated same-name tags. It is suited to SOAP, legacy system integration and config scenarios, and conversion runs locally in your browser so nothing is uploaded.
How to use it
- 1
Paste your JSON
Objects, arrays or scalars are all accepted; arrays and scalars are wrapped in a configurable root element.
- 2
Configure root and array item
In the options, set the root element name (default root) and the array item tag name (default item).
- 3
Copy the XML
Indented XML with an <?xml?> declaration is generated on the right; copy it for use.
- 4
Feed the target system
Paste the XML into a SOAP request, a legacy API or a config file as needed.
Key features
Arrays become repeated tags
{"list":[1,2]} outputs <list>1</list><list>2</list>, following the XML convention for collections.
Configurable root
The root element name and array item tag name can both be customised to match different message specs.
Invalid tag names flagged
When a JSON key contains characters that are illegal in XML tag names, the built document is re-checked and the problem location is reported.
Automatic entity escaping
Special characters such as &, < and > are escaped to entity references so the XML is accepted by strict parsers.
Handles scalars and null
Scalars are wrapped as text nodes and nulls are emitted as self-closing tags so no data breaks the structure.
Local and private
Conversion runs in your browser and the data is not uploaded.
Common errors & troubleshooting
- ! An XML document must have exactly one root element, so all JSON content is wrapped in a root node (default <root>).
- ! A JSON null becomes a self-closing tag <x/>; XML has no null, so converting back yields an empty string — a limitation of the format itself.
- ! Tag names may only start with a letter or underscore and cannot contain spaces or colons (add namespace prefixes manually in the result).
- ! Arrays of objects become repeated item tags, each containing the object fields.
Frequently asked questions
How are JSON attributes represented?
JSON has no distinction between elements and attributes, so this tool always outputs child elements. If the target system requires attributes, adjust the result XML by hand; converting back, attributes are preserved as @_-prefixed keys.
Why is there an extra <root> layer?
XML requires a single-rooted document, while JSON may be an array or an object with multiple top-level keys. Wrapping everything in a root guarantees legal XML for any JSON, and the root name can be changed in the options.
Are XML namespaces (xmlns) supported?
The output is well-formed XML, and namespace declarations can be written as ordinary attributes and recognised by the target system; the tool does not validate namespace semantics.
Is my data uploaded?
No. Conversion happens locally in your browser.
Related tools
XML to JSON
Convert XML to a JSON object. Attributes are kept as @_-prefixed fields by default, text alongside attributes uses a #text key, and attributes can be ignored. Validated first, runs locally.
JSON to CSV
Convert an array of objects into CSV you can open in Excel or WPS. Columns are the union of all keys, nested objects flatten to dot-separated names, and comma, semicolon, pipe or tab delimiters are supported.
JSON Formatter
Format, beautify and validate JSON in your browser. Errors point to the exact line and column, and you can indent with 2 spaces, 4 spaces or a tab.
JSON to YAML
Convert JSON to YAML while keeping the original structure, in a format that is easier to read and comment. Conversion errors point to the source position.