TsWorks Tools
All tools (39)

JSON to XML

Convert JSON into well-formed XML, attributes and all.

Indent

Paste JSON to convert it to XML.

JSON to XML

Converts JSON into well-formed XML. Objects become elements, arrays repeat their parent's element name, and primitives become text content.

Attributes

XML distinguishes attributes from child elements; JSON has no such idea. The convention here is the common one: a key beginning with@ becomes an attribute of its parent element, and#text becomes that element's text content. So{"user":{"@id":"1","name":"Ada"}} produces<user id="1"><name>Ada</name></user>. Turn the option off and every key becomes an element instead.

Keys that are not valid element names

XML element names cannot start with a digit and cannot contain spaces, and JSON keys routinely do both. Those characters are replaced with underscores and a leading digit is prefixed with one, deterministically - so the same input always produces the same output, and the result actually parses.

Related tools