JSON ⇄ XML

JSON ⇄ XML, both ways in one click.

Convert JSON to XML and XML to JSON with a customisable root element, attributes, CDATA and indentation. Runs locally, nothing uploaded.

Input

Output

Everything runs locally in your browser

What can this tool do?

JSON to XML: objects become nested elements and arrays become repeated sibling elements; keys starting with @ become attributes (optional), and values containing < can be wrapped in CDATA. XML to JSON: attributes merge into @-prefixed keys, repeated sibling elements collapse into arrays, text-only nodes become strings and CDATA is unwrapped. Root element name and indentation are configurable, and the output is one click to copy. Everything runs locally.

FAQ

How are arrays converted?

JSON arrays become repeated same-name elements. On the way back, several same-name children collapse into a JSON array; a single one stays as one object.

Why did some values become attributes?

That is the @ convention: a key starting with @ becomes an XML attribute, e.g. {"@id":1} becomes an id="1" attribute on the root element. Untick the attribute option to always emit child elements.

Further reading

觉得好用?Found it useful?