DeveloperKit

JSON to XML Converter

Convert JSON to clean, well-formed XML instantly. Free, private, and 100% in your browser.

Input JSON

XML Output

XML output will appear here.

Convert JSON to XML Online

JSON and XML are both widely used formats for exchanging structured data. Many modern APIs speak JSON, while enterprise systems, SOAP services, RSS feeds, and configuration formats often require XML. This tool converts JSON to XML in one step, with sensible conventions and options you control.

Features

  • Well-formed output

    Special characters are escaped and invalid key names are fixed automatically, so the XML always parses.

  • Attributes and text

    Keys starting with @ become XML attributes, and a #text key becomes the element's text content.

  • Custom element names

    Choose the root element name and the element name used for array items.

  • Formatting options

    Indent with 2 or 4 spaces or tabs, and include or omit the XML declaration.

  • Live validation

    Your JSON is validated as you type, with the exact line and column of any error.

  • Private by design

    The conversion runs entirely in your browser. Your data is never uploaded.

JSON to XML Example

JSON input
{
  "book": {
    "@id": "bk101",
    "title": "Clean Code",
    "authors": ["Robert C. Martin"],
    "price": 32.5,
    "available": true
  }
}
XML output
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <book id="bk101">
    <title>Clean Code</title>
    <authors>Robert C. Martin</authors>
    <price>32.5</price>
    <available>true</available>
  </book>
</root>

How to Convert JSON to XML

  1. Paste your JSON into the input editor, or upload a .json file.
  2. Set the root element name, array item name, and indentation.
  3. The XML output updates instantly as you type.
  4. Copy the XML to your clipboard or download it as a .xml file.

Frequently Asked Questions

How are JSON arrays converted to XML?

An array under a key becomes repeated elements with that key's name. For example, "tags": ["a", "b"] becomes <tags>a</tags><tags>b</tags>. Arrays without a key, such as a top-level array, use the Array item element name (item by default).

How do I create XML attributes from JSON?

Prefix a key with @. For example, {"book": {"@id": "bk101"}} becomes <book id="bk101"/>. Use a #text key to set the element's text content next to its attributes.

What happens to keys that are not valid XML names?

XML element names cannot contain spaces or start with a digit. Invalid characters are replaced with underscores, and names that start with a digit or with "xml" get an underscore prefix, so the output is always well-formed.

How are null values converted?

A null value becomes an empty, self-closing element, such as <middleName/>.

Is my JSON uploaded anywhere?

No. The converter runs entirely in your browser using JavaScript. Your JSON never leaves your device.

  • XML to JSON

    Convert XML to JSON with attributes, repeated elements as arrays, and automatic number and boolean detection.

  • JSON to CSV

    Turn JSON arrays into CSV for Excel or Google Sheets, with nested object flattening and custom delimiters.

  • JSON to YAML

    Convert JSON to clean, readable YAML for Kubernetes, Docker Compose, CI pipelines, and config files.

  • JSON to Base64

    Encode JSON as Base64 or base64url for headers, tokens, environment variables, and data URIs.