JSON Toolkit

Fast, private JSON tools that run in your browser.

🔒 Data stays in your browser

JSON to XML Converter

Convert JSON into well-formed, indented XML. Keys starting with @ become attributes, #text becomes element text, and arrays become repeated elements. Keys that are not valid XML names are fixed automatically and reported.

JSON ⇄ XML Converter

Keys starting with @ are attributes and #text is an element's text, e.g. { "price": { "@currency": "EUR", "#text": 9.99 } } ⇄ <price currency="EUR">9.99</price>. Lists become repeated elements.

The root element is only used when the JSON doesn't already have a single top-level key.

How to use the JSON to XML Converter

  1. Paste your JSON. Use "@name" keys for attributes and "#text" for element text.
  2. Choose the root element name, indentation, and whether to add an XML declaration.
  3. Click Convert to XML, then copy the result or download it as a .xml file.

Features

  • Attributes and element text through @name and #text keys
  • Arrays become repeated elements
  • An automatic root element when the JSON has more than one top-level key
  • Invalid names fixed automatically, for example first name → first_name
  • Correct escaping of &, < and quotes
  • Optional XML declaration and 2 or 4 spaces of indentation

Frequently asked questions

How do I create an XML attribute?
Start the key with @. For example {"price": {"@currency": "EUR", "#text": 9.99}} becomes <price currency="EUR">9.99</price>.
Why was my JSON wrapped in <root>?
XML documents need exactly one root element. If your JSON has several top-level keys, or is an array, it is wrapped in a root element, which you can rename.
What happens to null values?
They become empty elements, such as <note/>.

Related tools