JSON to XML
Convert structured JSON data into standard XML format
Bridge JSON and XML
Modern APIs speak JSON, but plenty of enterprise systems, SOAP-style services and configuration formats still want XML. This converter reads a JSON document and writes the equivalent tree of tags. It starts the output with an XML declaration and runs entirely in your browser once the page has loaded.
Converting in three moves
- Paste JSON into the Source JSON box, or press Sample to load an example with a user object and a list of items.
- Press Convert to XML. If the JSON is malformed, an Invalid JSON dialog explains the parser error.
- Look over the dark XML Output panel and press Copy XML.
Mapping rules the tool follows
- Every JSON key becomes a tag with the same name, and its value is placed between the opening and closing tags.
- Nested objects become nested tags.
- Array entries are each wrapped in an item tag inside the parent element for the array.
- If your JSON has exactly one top-level key whose value is an object or array, that key becomes the root element. Otherwise the whole document is wrapped in a root tag named root.
- Numbers, booleans and text are written as element content; null appears as the word null.
So {"user":{"name":"John"}} yields a user root containing a name tag, while a top-level object with several keys is placed inside root.
Who uses this
- Developers feeding a JSON payload into a legacy service that only accepts XML.
- Testers who want quick XML samples that correspond to an existing JSON fixture.
- Analysts moving a small reference dataset between two tools with different import formats.
Points to check afterward
The output is a single continuous line with no indentation, so run it through a formatter if people will read it. Values are inserted as-is, without escaping, so text containing an ampersand or angle bracket will produce invalid XML and should be cleaned first. Keys are used verbatim as tag names, which means keys with spaces, or starting with a number, will not be valid tags. JSON has no attributes, so everything is written as elements. A top-level array is best wrapped in an object with a named key, for example {"orders":[...]}, so you get a meaningful root and item tags.
Related Articles
Related Tools