Developer Tools

JSON to XML Converter: Convert JSON to XML Online

Paste JSON and get well-formed XML with the indentation you choose. Objects become elements, each array item becomes a repeated element, keys starting with @ become attributes and #text becomes element text. Invalid XML names are fixed automatically.

01

Your inputs

Start with the example, or enter your own values.

Processed in your browser. Your inputs stay on this device.

02

Your result

A little clarity, coming right up.

Make room for the answer.

Enter your values and run the tool. Your result will appear here.

How to use the JSON to XML Converter

Fill in the fields above and the result appears straight away. Everything runs in your browser, so nothing you type is uploaded.

Read more: How to Use the JSON to XML Converter: Steps and a Worked Example

Examples

  • With the default values
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
      <book id="bk101">
        <title>XML Basics</title>

Limitations and assumptions

Keys that are not valid XML names are made valid (spaces and symbols become _, a leading digit gets _). Nothing is uploaded; the conversion runs in your browser.

Frequently asked questions

How are JSON arrays converted to XML?

Each item becomes its own element with the array's key as the name, so "author": ["Ann", "Raj"] gives 2 <author> elements. A top-level array is wrapped in <item> elements.

How do I make an XML attribute?

Start the key with @. {"book": {"@id": "bk101"}} becomes <book id="bk101"/>. Use "#text" for the text inside an element that also has attributes.

Why does my key get an underscore?

XML names cannot contain spaces or most symbols and cannot start with a digit, so those characters become _ and a leading digit gets a _ in front.