JSON to XML & XML to JSON
Convert JSON to clean XML or parse XML back into structured JSON in your browser. Your work stays on this device whenever possible.
How to use JSON to XML & XML to JSON
- Paste your structured input into the source editor, or press "Load Sample" to insert a sample project record, then select the conversion direction.
- When generating markup, name the outer wrapper in "Root Tag" (blank falls back to root) and set "Indentation" to 2 or 4 spaces.
- Use property keys starting with @ for element attributes, and a "#text" key for inner text when a node also carries attributes.
- Press "Convert Data"; any syntax problem appears in the status line with the parser's exact error message.
- Choose "Copy" or "Download File" to save the converted output to your device.
Worked example
With the default root wrapper, convert {"book":{"@id":"7","title":"Dune","tags":["sf","classic"]}}. The output begins with a standard declaration header and a <root> wrapper. Inside it, <book id="7"> holds a <title> element containing Dune and two <tags> elements, one with sf and one with classic, indented by 2 spaces per nesting level.
When to use this tool
- Transforming a REST API payload into tag-based markup for a legacy enterprise SOAP or ERP endpoint.
- Inspecting a verbose configuration file as a compact key-value object tree to see its structure at a glance.
- Generating a well-formed fixture file with attributes and nested lists for a unit test.
Important limitations
JSON objects have no built-in single root element, while valid XML documents require exactly one root tag. The converter wraps multiple top-level keys into the specified root element.
Comparing alternatives
Other options for json to xml & xml to json include CodeBeautify, FreeFormatter, JSON2XML.
ToolkitPoint is not affiliated with those services.
Frequently asked questions
How are arrays represented in tag markup?
Each array entry becomes a repeated sibling element named after its parent property key, so "tags": ["a","b"] yields two <tags> elements. A top-level array is wrapped as <item> elements inside the outer root tag.
Do element attributes survive reverse conversion?
They appear as object properties with an @ prefix, but a node holding both attributes and inner text loses the inner text because only the attribute keys are kept. For example, a price element with a currency attribute and the value 9.5 comes back as {"@currency":"USD"}.
Are numbers and booleans restored when reading markup?
No. Tag-based markup has no native primitive types unless paired with an external schema, so every leaf value returns as a text string, including "42" and "true", with surrounding whitespace trimmed. Cast values afterwards if your application expects numeric or boolean types.
What if a property key is not a legal element name?
The property key is used verbatim as the tag name, so a key containing spaces or starting with a digit produces malformed output. Rename those keys before converting. Inner text values and attribute strings are automatically escaped for ampersands, angle brackets and quotes.
What happens to the outer root element when parsing markup?
The outer wrapper tag name is dropped and the resulting object holds its child nodes directly. A <library> wrapper containing <book> children yields a "book" property at the top level. Specify "Root Tag" on the way back to restore the outer wrapper.