JSON to XML Converter
Convert JSON to well-formed XML in your browser, with a root element of your choice, arrays as repeated elements and @-prefixed keys as attributes.
Free · No sign-up · Your inputs stay in your browser
Input
Convert JSON to XML
Output
XML
439 characters
Arrays repeat their parent's element name, which is how most XML APIs model lists. Keys that are not valid XML names are rewritten with underscores, and a #text key becomes the element's text.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
There is no single right mapping
JSON has arrays and typed values; XML has attributes, mixed content and repeated elements. Every converter picks a convention, and the one here is the common one used by Jackson's XmlMapper and by most SOAP bridges: an array of items under a key becomes several elements with that key's name. If the receiving system expects a wrapper element around lists, add it to the JSON first.
Escaping and names
The five characters XML reserves (&, <, > and both quotes) are escaped in text and attribute values. Element names may not start with a digit or with the letters xml, so keys like 2fa are prefixed with an underscore. The result is well-formed; checking it against an XSD needs the schema, which the XML formatter page explains.