Code & Data

Convert JSON to XML

Paste JSON and get an XML document — declaration, indentation, escaped content, and element names sanitised so the result actually parses.

or paste your own — nothing is uploaded.

JSON keys become element names. Characters XML does not allow in a name become underscores.

XML

Paste valid JSON above and the result appears here.

  • Runs in your browser
  • No account required
  • Free to use

How it works

01

JSON keys are not always valid XML names

A JSON key can be anything, including “first name” or “2024”. XML names cannot contain spaces and cannot start with a digit. Rather than emit a document no parser will read, invalid characters become underscores and a leading digit gets a prefix.

02

Text is escaped, all five entities

Ampersands, angle brackets and quotes in your data are escaped. An unescaped ampersand is the single most common reason a generated XML file fails to parse.

03

A top-level array gets a wrapper

XML documents have exactly one root element. An array at the top level would produce several, so it is wrapped in a named root with each item as a child — which is the shape every XML-to-JSON mapping produces in reverse.

What it does

Configurable root element

Name the root to match whatever schema is going to read it.

Indented and declared

An XML declaration with the encoding, and two-space indentation, so the result is readable as well as valid.

Key sorting

Optional and recursive, for stable output in version control.

Your data never leaves the page

API responses, config files and exports are exactly the sort of thing that should not be pasted into someone else’s server. Parsing happens in your browser and what you paste is never transmitted — there is no code here that could send it anywhere, even by accident.

Practical advice

Getting a better result

  • XML has no arrays. A JSON array becomes repeated elements of the same name, which is how XML has always expressed a list.
  • If your keys contain spaces or start with digits, check the element names in the output — they have been changed to be legal.
  • For a schema-specific format, treat this as a starting point rather than a finished document. Attributes in particular have no JSON equivalent to map from.

Questions

Things people ask

How are JSON arrays represented?

As repeated elements sharing the parent’s name — XML has no array type, and repetition is how it has always expressed a list. A top-level array is wrapped in a single root element so the document stays well-formed.

What happens to keys XML does not allow?

Characters that are not valid in an element name become underscores, and a name starting with a digit gets an underscore prefix. Without that, the output would look right and fail to parse.

Who builds these

Free tools by day. Websites that earn their keep by trade.

KuConvert is built by KUDUY, a web design and development agency. From custom WordPress builds to SEO and e-commerce, everything they do is engineered to bring you more qualified traffic and turn it into revenue.

  • Fixed scope, no surprise invoices

    Most sites ship in four to eight weeks with the scope and the price agreed up front.

  • SEO from day one

    Search is designed into the build — structure, schema and Core Web Vitals — not retrofitted.

  • A team, not a ticket queue

    A project manager, a designer and a developer you can actually reach.

Need your whole site to load this fast?

Images are usually the heaviest thing on a page and the easiest win. KUDUY works on site speed, image delivery and Core Web Vitals for teams who would rather not do it by hand.

This tool runs entirely in your browser. Your files are never uploaded.