01 / Example
Example
{"person":{"name":"Ada","message":"Hello"}}<person>
<name>Ada</name>
<message>Hello</message>
</person>Code Beautify / MULTIVERTO
Map a JSON object with one root to XML elements.
Apply each text tool to the previous result. Text workflows ↗
Only the recipe name and tool order are saved in this browser. Your input and results are never saved.
01 / Example
{"person":{"name":"Ada","message":"Hello"}}<person>
<name>Ada</name>
<message>Hello</message>
</person>02 / Guide
Map a JSON object with one root to XML elements. The JSON input must have exactly one outer key to name the XML root. Child arrays produce repeated XML elements, and @attributes supplies attributes. Review generated element names, since JSON keys that are legal there are not always legal XML names.
An XML document is an ordered tree of elements and attributes, while a JSON object is a collection of named values. This converter uses a declared convention: one outer JSON key becomes the XML root; an @attributes object becomes attributes; a #text field becomes text; arrays become repeated child elements.
Start with a JSON object containing exactly one root name. Under that root, ordinary properties become child elements, repeated values can become repeated sibling elements, and the reserved attribute and text fields control XML attributes and text content. Names must be legal XML names; a JSON key that is valid in JSON is not automatically a valid element name. The converter escapes characters that would be markup in text or attributes. It refuses unsupported mixtures of nonblank text and children rather than guessing their order. Inspect the hierarchy of one nested branch and the treatment of empty values before using the result in a service that expects a particular XML schema. In the live example, with line breaks shown as JSON escapes, input "{\"person\":{\"name\":\"Ada\",\"message\":\"Hello\"}}" produces output "<person>\n <name>Ada</name>\n <message>Hello</message>\n</person>". Create a root with an @attributes map, one repeated child name and text containing an ampersand. Examine the XML tags and escaped text separately. If your destination requires an XML declaration, namespace or prescribed child order, add and validate those requirements in that destination; this conversion does not infer them.
Use this for a small object whose single outer property names the XML root. Check repeated children and @attributes against the receiving XML schema; names legal in JSON are not always legal XML element names. Test entity escaping with an ampersand or less-than sign. The converter cannot infer namespaces or a schema from arbitrary JSON. Parse the XML output in the destination and check the root, attribute names, child order and repeated elements. The generated document may be well formed while failing an XML schema or application contract. A numeric JSON value becomes XML text, so its type is not preserved unless the receiver applies its own rule. If your source requires interleaved text and child elements, this mapping cannot express it; choose a representation designed for mixed content. Keep the original JSON and compare a small round trip, paying attention to arrays that contain only one entry.
Explore guides