Skip to the content

Contact usFree tools · No signup · Files stay on your device

JSON to XML Converter

Paste JSON and get well-formed XML with an optional declaration and your choice of indent. Keys that XML cannot use are renamed for you, and the tool tells you which ones.

  • PrivateYour data never leaves this device
  • No uploadsProcessed in your browser, not on a server
  • 100% freeNo signup, no watermark, no trial
  • UnlimitedUse it as often as you like, no daily caps

How we protect your privacy →

Options

Used when the JSON has several top-level keys, or is an array.
For arrays that have no key of their own.

JSON input

XML output

Output appears here.
Need the reverse? XML to JSON converter
Was this tool helpful?
How it works

How to use the JSON to XML.

4 short steps. Nothing to install, nothing uploaded.

  1. 1

    Paste your JSON, click Open file, or press Sample to try it.

  2. 2

    Set the root element name (used when the JSON has several top-level keys or is an array) and the name for array items.

  3. 3

    Choose how attributes are marked in your JSON (@name, _name or a $attrs object), the indent, and whether to add the XML declaration.

  4. 4

    Copy the XML or download it as a .xml file. Any renamed keys are listed under the output.

Guides

Guides for JSON to XML

All

XML to JSON: the complete guide to converting XML data

Learn how to convert XML to JSON online: how attributes, text, repeated tags and namespaces are written, what each option does, and what JSON cannot…

XML Formatter: the complete guide to validating and beautifying XML

A complete guide to formatting XML online: beautify or minify, pick the indent, sort attributes, strip comments, and read every well-formedness error…

JSON to XML: the complete guide to converting JSON data

How to convert JSON to XML online: how arrays, @attributes and #text are written, why a root element appears, how invalid key names are fixed, and…

Word to Text: the complete guide to getting plain text from Word files

How to get plain text out of a Word .docx file: how headings, lists, tables and links are laid out, how to wrap lines at 72 or 80 characters, and what…

Word to Markdown: the complete guide to converting DOCX to MD

How to convert a Word DOCX to GitHub-flavoured Markdown: headings, lists, tables, escaping, pictures and page breaks, and what Markdown cannot keep…

Word to HTML: the complete guide to clean HTML from DOCX

How to convert Word to clean HTML: full page or body only, minimal, inline or no styles, pictures, tables and lists, plus what is not carried over…

Page 1 of 19
Questions

Frequently asked questions.

Quick answers about the JSON to XML.

How do I make attributes and text in the XML?
Keys starting with @ become attributes, so {"book": {"@id": 1}} gives <book id="1"/>. A "#text" key is the element's text, which is how an element can have both attributes and text. You can switch to _name keys or a $attrs object if your JSON uses those.
What happens to arrays?
An array under a key becomes repeated elements: "tag": ["a", "b"] gives <tag>a</tag><tag>b</tag>. An array with no key of its own, such as a top-level array or an array inside an array, uses the item name you set, which is item by default.
Why does my XML have a root element I did not write?
XML needs exactly one root element. If your JSON has a single top-level key, that key is the root. If it has several keys, is an array or is just a value, it is wrapped in the root name you choose, root by default.
JSON keys can be anything, but XML names cannot. What then?
Spaces and symbols become underscores and a name starting with a digit gets an underscore in front, so "first name" becomes first_name and "1st" becomes _1st. The converter lists every renamed key so nothing changes silently.
Are special characters escaped?
Yes. & and < are escaped in text, quotes and line breaks are escaped in attribute values, and control characters that XML cannot hold at all are removed with a note. The output is always well-formed.
Is my JSON uploaded anywhere?
No. The conversion runs entirely in your browser, so API responses and configs never leave your device.