JSON to XML
It helps to convert your JSON data to XML format.
Runs in your browser Your input never leaves your device.
About this tool
Converts JSON into an XML document in your browser. Objects become nested elements, with each key used as the tag name. Arrays repeat the element once per item, and text values are escaped for &, < and >. You can change the root element name, which defaults to root. The output starts with an XML declaration. Keys that contain characters not allowed in XML tag names have those characters replaced by underscores, but a key that starts with a digit is not renamed, so check the result if you need strictly valid XML. There are no attributes, and numbers, booleans and null are written as text (null as an empty element).
How to use it
- Paste your JSON.
- Set the root element name if you want something other than root.
- Copy the XML output.
Example
{"user":{"name":"Ann","tags":["a","b"]}}<?xml version="1.0" encoding="UTF-8"?>
<root>
<user>
<name>Ann</name>
<tags>a</tags>
<tags>b</tags>
</user>
</root>Common problems
- A syntax error appears
- The JSON is invalid. Look for missing quotes, trailing commas or unclosed brackets.
- A top-level array has several roots
- A top-level array outputs one root element per item, which is not a single-root XML document. Wrap the array inside an object first.
- Tag names changed
- Special characters in keys become underscores. Keys that start with a number are not valid XML names and need to be renamed.