Adapt a simple exchange
Turn a small object into XML elements for an integration example. The receiver must accept root or you must adapt it deliberately.
Switch quickly between JSON and XML structures and get formatted output ready to copy or reuse in your project.
Convert a JSON structure to XML or simple element-based XML to JSON. These formats carry different information, so this tool uses an explicit limited convention rather than promising a universal round trip. Processing stays in your browser. Use it for a small data exchange or to inspect a service response, then check the receiving contract. XML with attributes or mixed prose needs a richer conversion model.
Direction comes from the trimmed input: { or [ selects JSON to XML; other input goes to XML parsing. JSON to XML adds a root element named root. Properties become elements, and arrays contain item elements. Keys must be supported simple XML names; spaces, colons and names starting with xml are rejected. Text characters are escaped to produce valid XML.
XML to JSON retains the root name. Repeated same-named siblings become an array; a single element remains a scalar or object. Leaves are strings: <n>2</n> becomes "2", not the number 2. Empty leaves become empty strings. Attributes, comments, processing instructions and unrepresentable mixed content are rejected instead of silently dropped. DOCTYPE is also rejected.
No business schema is inferred. Order across groups of differently named elements may be lost in JSON, and XML cannot distinguish a single-item list from one standalone element. Text versions of null, numbers and booleans do not regain their JSON types automatically. Conversion depth is limited; JSON numbers use the browser’s numeric precision. Use strings for long identifiers if your contract allows it.
Provide a JSON object or array, or a complete XML document. Direction is automatic without a separate direction control.
Run it and check types, root and arrays. An error message is not a usable partial conversion.
Copy or download .xml or .json. Errors are presented as text; retain the original to check structural distinctions that do not survive conversion.
Turn a small object into XML elements for an integration example. The receiver must accept root or you must adapt it deliberately.
Inspect repeated siblings as a JSON array. Also test a single element, whose output shape differs.
An attributes or mixed-content rejection means this model cannot represent part of your document. Keep the source and choose a richer mapping.
The engine wraps the object in root and turns name into an element. Converting back does not automatically remove that added root.
Input
{"name":"Ada"}Result
<root><name>Ada</name></root>The two item elements become an array of strings under root. Their text is not interpreted as numbers, booleans or JSON documents.
Input
<root><item>A</item><item>B</item></root>Result
{
"root": {
"item": [
"A",
"B"
]
}
}This convention defines no attribute representation. Ignoring them would lose data; rejection lets you choose a mapping suited to your format.
Simple XML contains text without JSON types. The tool does not guess whether 01 is a code, a number or text to preserve.
The interface detects objects and arrays using { or [. A standalone string, number or null does not select JSON to XML.
No. Added roots, textual types, sibling grouping and cardinality can alter structure. Compare output with the intended contract, not just field names.
Related tools
Tools similar or complementary to this one.
Format, minify, and validate an XML document directly in your browser.
Format, minify, and validate JSON to make it easier to read or more compact.
Convert JSON data to YAML or YAML data to JSON directly in your browser.
Understand ISO 8601 week numbers, Unix timestamps in seconds or milliseconds, and the difference between human-readable dates and technical time values.