How to Use the JSON to XML Converter: Steps and a Worked Example
Convert JSON to well-formed XML in your browser: objects become elements, arrays repeat, and @ keys become attributes. This guide shows what to enter, a worked example, and the limits to keep in mind. The JSON to XML Converter tool is free, needs no account and runs in your browser.
What you need
- Paste JSON
- Root element name, for example root
- Indent: choose 2 spaces, 4 spaces, Tab, Minified (one line)
- XML declaration: choose Include, Leave out
Step by step
- Open the JSON to XML Converter tool.
- Fill in Paste JSON.
- Fill in Root element name.
- Choose Indent.
- Choose XML declaration.
- Read the result, which updates as soon as the inputs change.
Worked example
With these inputs:
- Root element name: root
- Indent: 2 spaces
- XML declaration: Include
the tool returns:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<book id="bk101">
<title>XML Basics</title>
<author>Ann Lee</author>
<author>Raj Patel</author>
<price>29.99</price>
<inStock>true</inStock>
How it works
Everything runs in your browser, so nothing you type is uploaded.
Things to keep in mind
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.
Related tools
If this is not quite what you need, try JSON Formatter, JSON Validator or XML Formatter.