JSON to XML Converter
Convert JSON to XML instantly
JSON Input
Options
XML Output
Converted output will appear here...
Overview
The JSON to XML Converter turns a JSON object or array into well-formed, indented XML — useful when a legacy SOAP service, enterprise integration, or XML-only configuration format is the only thing standing between your JSON data and where it needs to go. It builds real XML with a proper builder, not string concatenation, so nesting, attributes, and formatting come out correct.
What This Converter Detects and Handles
- •Attribute mapping: JSON keys prefixed with @_, such as "@_id": "42", become XML attributes on the enclosing element instead of child elements
- •Repeated elements from arrays: a JSON array value becomes a sequence of sibling XML elements that share the same tag name as the key
- •Configurable indentation: choose 2, 4, or 8 spaces, or disable formatting entirely for compact, single-line XML
- •Empty-node suppression: optionally collapse empty elements to self-closing tags instead of writing empty open and close pairs
- •Attribute-ignoring mode: treat every key, including @-prefixed ones, as a regular child element instead of an attribute, when you want a strictly element-only document
- •Runs entirely in your browser: your JSON data is never uploaded to a server
When You'd Convert JSON to XML
- •Sending data to a legacy SOAP web service or enterprise system that only accepts XML requests
- •Producing an XML configuration file, for a build tool, CI system, or .NET or Java application, from JSON you already maintain
- •Generating an RSS/Atom-shaped XML feed from a JSON array of articles or items for syndication
- •Round-tripping data you already converted from XML — edit it as JSON, then convert back to XML for a system that expects the original format
- •Producing XML test fixtures for API contract tests from JSON payloads you already have on hand
How to Convert JSON to XML
- 1.Paste a JSON object, wrapped in a single root key, into the input editor, or upload a .json file
- 2.Decide whether @-prefixed keys should map to XML attributes, or toggle Ignore Attributes to emit everything as elements
- 3.Choose an indentation width, or turn off formatting for compact output
- 4.Enable empty-node suppression if you want self-closing tags for empty values
- 5.Click Convert, then copy the XML output or download it as .xml
Edge Cases Worth Knowing
- •XML requires a single root element — a JSON payload that is a bare array, or an object with more than one top-level key, produces multiple sibling elements at the root, which is not valid XML; wrap your data in one root key first, such as { "root": { ... } }
- •JSON values with no direct XML equivalent, such as null or an array mixing objects and primitives, are stringified, which can look different from a hand-written XML document
- •Key names that are not valid XML tag names — starting with a digit, or containing spaces or characters like &, <, and > — will produce invalid XML that downstream parsers may reject
- •Booleans and numbers are written out as their literal text form, such as true or 42, with no XML Schema type annotation attached — the receiving system has to already know what type each element represents
Limitations
- •The tool does not generate or validate against an XSD schema — the output is well-formed XML, not XML guaranteed to conform to a specific system's schema
- •There is no built-in way to declare an XML namespace (xmlns) on the output — namespaced tag names must already exist as prefixed keys in your JSON, such as "env:Envelope"
- •Very large JSON arrays can exceed browser memory during the build step — use a script-based tool, such as a Node.js job built on fast-xml-parser directly, for very large exports
Need to Go the Other Way?
If you're starting from XML — a SOAP response, an RSS feed, or a legacy config file — and need JSON for a JavaScript or Node.js codebase, use the XML to JSON Converter instead. It validates the XML, reports parse errors with line numbers, and gives you control over how attributes and namespaces map into JSON.