JSON to XML

Convert a JSON object to XML with attributes under @attributes, text under #text and arrays as repeated elements.

Your workspace

Server processing

Review the example values, then run the tool.

This utility transforms JSON objects into XML markup. It is designed for developers who need to map JSON data structures to XML formats, ensuring that attributes, text nodes, and nested arrays are represented correctly in the output.

How to convert JSON to XML

  1. Paste your JSON object into the input area. Ensure your JSON has exactly one root property, as XML requires a single root element.
  2. Submit the data to generate the XML. The tool maps JSON keys to XML tags, using '@attributes' for attributes and '#text' for node values.

Handling JSON structures

The converter follows specific mapping rules: keys starting with '@attributes' become XML attributes, while '#text' keys define the content within a tag. Arrays in JSON are converted into repeated XML elements with the same tag name. Note that XML tag names must follow standard naming conventions, meaning they cannot contain invalid characters or start with numbers, and the input must be a single root object.

Example conversion

{"book": {"@attributes": {"id": "1"}, "title": "Example"}}

<book id="1"><title>Example</title></book>

Questions about this conversion

Why does my JSON input fail to convert?

The tool requires a single root object. If your JSON is an array or contains multiple top-level keys, you must wrap it in a single parent object before submission.

How are arrays handled in the output?

Arrays are processed by repeating the element tag for each item in the array. This ensures that the resulting XML structure remains valid and readable by standard XML parsers.

Continue your workflow