Feeding an API that only accepts XML
Wrap your payload in a single top-level key named after the expected root element, and use @ keys for anything the endpoint expects as an attribute.
Turn JSON into well-formed XML in your browser, with escaping and element naming handled correctly.
Maintained by Roshan.
Converts between XML and JSON in this tab using the browser's own XML parser. Nothing is uploaded, which matters for the configuration files and invoices these formats usually carry.
Find related browser-local tools for nearby tasks without starting another search.
Browse all developer and data toolsGenerating XML from JSON is easier than the reverse, because XML can express everything JSON can and more. The difficulties are narrower and more mechanical: XML has strict rules about what an element may be called, and a set of characters that must be escaped or the document will not parse. JSON has neither restriction. A key containing a space, a leading digit, or an ampersand is perfectly ordinary JSON and completely illegal as an XML tag name, and a value containing a less-than sign will break the document unless it is escaped. Most quick converters ignore both problems and emit output that no XML parser will accept. This one repairs names and escapes values, and shapes the result so that feeding it back through the XML to JSON converter returns what you started with.
Wrap your payload in a single top-level key named after the expected root element, and use @ keys for anything the endpoint expects as an attribute.
Many older tools read XML configuration exclusively. Building the structure in JSON first is usually quicker and less error-prone than writing tags by hand.
Give your JSON a single top-level key. That key becomes the root. Objects with several top-level keys are wrapped in a generic root instead.
Prefix the key with @. A key of @id becomes an id attribute on the enclosing element.
The space becomes an underscore, because XML element names cannot contain spaces. Emitting the invalid name would produce a document no parser accepts.
Yes. The @ and #text conventions and the array shape are all chosen so the XML to JSON converter returns the original structure.
No. The JSON is parsed and the XML built entirely in this tab.
Convert XML to readable JSON in your browser. Attributes, repeated tags and mixed content are all handled predictably.
Format, minify, and validate JSON locally in your browser. Inspect keys, values, nesting depth, and root type without sending private API data to a server.
Convert JSON objects to UTF-8 CSV in your browser. Union columns, quote values, and protect formula-like strings.
Turn JSON into an INI configuration file in your browser, with objects becoming sections.
Turn a JSON array into a clean HTML table in your browser, with markup in the data escaped safely.