Small Tools
YAML, XML & Data utility

JSON to XML

Convert a JSON object into XML elements and attributes.

● This tool runs entirely in your browser. Your input is never uploaded to our servers.
Output
Your result will appear here…

How to use JSON to XML

  1. Paste a JSON object.
  2. Select Convert.
  3. Review the XML and copy it.

Example

Input / settings:

{"person":{"name":"Ada","active":true}}

Output:

<root>
  <person>
    <name>Ada</name>
    <active>true</active>
  </person>
</root>

The tool adds the root element. Booleans and numbers are written as text.

When to use

Overview

JSON to XML wraps a JSON object in a root element named root and turns each property into a child element indented by two spaces. Arrays become repeated item elements, and the special keys @attributes and @text produce attributes and text content. The output has no XML declaration, and the top-level JSON value must be an object.

Supported input

JSON object

Output details

XML

Limitations

Common mistakes

Practical tips

Privacy and security

This tool runs entirely in your browser. Your input is never uploaded to our servers. Conversion runs locally. Ampersands and angle brackets in text are escaped, and quotes inside attribute values are escaped too. Because property names must match a simple name pattern, a key cannot inject markup into the output.

References

Frequently asked questions

Can I change the name of the root element?

No. The root element is always called root. A top-level property becomes a child of it.

How do I write XML attributes?

Use a property named @attributes whose value is an object. Each of its properties becomes an attribute of the surrounding element.

Does the output include an XML declaration?

No. The result starts with the root element and uses two-space indentation, with no options to change either.

Related tools