---
title: "JSON to XML Converter: Free, Well-Formed XML"
description: "JSON to XML converter that always writes well-formed XML. Bad key names are renamed and listed by line, big numbers stay exact. Runs in your browser."
canonical: "https://browser-use.com/tools/json-to-xml"
last_updated: "2026-11-13"
---

# JSON to XML Converter: Free, Well-Formed XML

## JSON to XML Converter

Convert JSON to XML in your browser. The XML is always well-formed: keys and characters XML cannot hold are renamed or escaped, and listed. Copy or download it.

## How it works

### Paste or open a file

Paste JSON, open a file up to 5 MB, or drop one on the box. It is read in this tab and never uploaded.

### Pick the options

Name the root element, choose the indent, and decide whether @keys become attributes.

### Copy or download

Check the list of changes, then copy or download the XML.

### How are arrays converted?

Each item becomes an element named after the array's key: {"tag": \["a", "b"\]} gives <tag>a</tag><tag>b</tag>. A top-level array, or a list inside a list, gets <item> elements. An empty array under a key has nothing to repeat, so it is left out and listed. null and {} become an empty element, <a/>.

Source: [XML 1.0 §3.1 Start-tags, end-tags and empty-element tags](https://www.w3.org/TR/xml/#sec-starttags)

### What happens to keys that are not XML names?

An XML name cannot be empty, start with a digit, - or ., or hold spaces and most symbols. Such keys are renamed: each character a name cannot hold becomes \_, with \_ added in front when needed, so "first name" becomes first\_name and "1st" becomes \_1st. A key like "a:b" keeps its colon only when its prefix is declared, for example with "@xmlns:a". Every rename is listed with its line.

Source: [XML 1.0 names](https://www.w3.org/TR/xml/#NT-Name) · [Namespaces in XML 1.0](https://www.w3.org/TR/xml-names/#ns-qualnames)

### Which characters are escaped?

& and < always, and > too, so \]\]> cannot appear in text. In attributes, quotes, tabs and line breaks are written as references, because a parser turns a raw tab or line break there into a space. Control characters such as U+0001 are not allowed in XML 1.0, even as references, so they become U+FFFD and are listed.

Source: [XML 1.0 §2.4 Character data](https://www.w3.org/TR/xml/#syntax) · [§2.2 Characters](https://www.w3.org/TR/xml/#charsets) · [§3.3.3 Attribute-value normalization](https://www.w3.org/TR/xml/#AVNormalize)

### How do attributes work?

With "@keys as attributes" on, "@id": "7" becomes id="7" and "#text" becomes the element's text: {"price": {"@currency": "EUR", "#text": "9.50"}} gives <price currency="EUR">9.50</price>. XML to JSON uses the same convention, so attributes and text convert back. Order is not always kept: text between child elements is written in one place, and elements with the same name are grouped.

Source: [XML to JSON](https://browser-use.com/tools/xml-to-json)

### Are big numbers kept?

Yes. Numbers are written as they appear in the JSON: 12345678901234567890 stays 12345678901234567890 and 1.10 stays 1.10. JavaScript's JSON.parse rounds integers past 2^53 - 1; this converter reads the JSON text itself. Key order is kept too.

Source: [RFC 8259 §6 Numbers](https://www.rfc-editor.org/rfc/rfc8259.html#section-6)

## Need data from a website, not a file?

Browser Use agents open pages in a real browser, including dynamic ones, and return structured data.

[See AI web scraping](https://browser-use.com/web-scraping)

Converted: 12 elements, 1 change

JSON{ "store": "Lisbon & Porto", "orderId": 9007199254740993, "paid": true, "coupon": null, "items": \[ { "@sku": "B-12", "name": "Notebook <A5>", "qty": 2 }, { "@sku": "P-07", "name": "Pen", "qty": 10 } \], "ship to": "Rua Augusta 1, Lisboa" }

Load exampleOpen .json file

Runs in your browser. Your JSON is never uploaded.

Valid JSON · 260 B

Root element

Wraps the JSON, unless it is an object with one key whose value is not a list: that key becomes the root.

Indent

2 spaces4 spacesOne line

@keys as attributes

"@id" becomes id="…" and "#text" the element's text, as in [XML to JSON](https://browser-use.com/tools/xml-to-json).

XML declaration

Keys that are not [XML names](https://www.w3.org/TR/xml/#NT-Name) are renamed and listed. Lists become repeated elements. Numbers stay as written.

## XML · 360 B

Copy XMLDownload .xml

1 change to make valid XML

-   Line 10: Key "ship to" is written as <ship\_to>: not a valid XML name.

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <store>Lisbon &amp; Porto</store>
  <orderId>9007199254740993</orderId>
  <paid>true</paid>
  <coupon/>
  <items sku="B-12">
    <name>Notebook &lt;A5&gt;</name>
    <qty>2</qty>
  </items>
  <items sku="P-07">
    <name>Pen</name>
    <qty>10</qty>
  </items>
  <ship\_to>Rua Augusta 1, Lisboa</ship\_to>
</root>

---

BROWSER USE

- Browser Use Agents: give Browser Use a task and receive completed work. API V4 is current for new integrations.
- Browser Infrastructure: connect your agent or automation to managed browsers through SDK, REST, or CDP. Starts at $0.06/browser-hour.
- Developer tools: Open Source, Browser Harness, SDK, and MCP support the two products above.

[Developer Index](https://browser-use.com/index.md)
[Product Map](https://browser-use.com/llms.txt)
[Full Product Context](https://browser-use.com/llms-full.txt)
[Pricing](https://browser-use.com/pricing.md)
[Cloud Docs](https://docs.browser-use.com/cloud/quickstart)
[Open Source Docs](https://docs.browser-use.com/open-source/introduction)
