JSON to XML Converter

Builds an XML document from a JSON object on this page.

Use this tool

Result

The result appears in this panel after you run the tool.

About this tool

This page converts the whole document. CSV tools flatten one selected row collection instead.

Mixed content and namespaces may be simplified. This is a structural conversion, not a schema mapping.

How to use it

  1. Open this page and provide the input it asks for.
  2. Set the options that are visible, then use Convert.
  3. Read the result in the panel. Copy it or download it when a file is offered. The input stays in this browser.

Limitations

Object keys become tags, with a few dangerous roots

An object is the shape the builder can name

JSON is parsed, then an XML builder with attributes enabled and formatting on writes the value. Keys become element names. A key that starts with @_ becomes an attribute of its parent, which is how a document produced by the XML-to-JSON page can carry attributes back. A #text key becomes character data. Nested objects become nested elements. An array of objects under a key becomes a repeated element of that key’s name. An array of strings under a key becomes repeated elements whose text is each string. Indentation in the result is the builder’s indent, not a delimiter, and it is not the JSON’s indent.

Null becomes an empty element. XML has no null, so a later read of that empty element will not know a null was intended versus an element that was always empty. Booleans and numbers become text. The string 01 stays 01 because it was a string. A JSON number that had been a zero-padded string in some earlier format is already a number before this builder runs, and the zero is already gone. Comments cannot be expressed. Duplicate JSON keys were collapsed by the parse.

Roots that are not objects

A bare number produces no markup. The value disappears. A bare string is walked like a list of characters and emitted as elements named with indexes, so a short word becomes a pile of single-letter tags. A top-level array becomes sibling elements named with indexes rather than one wrapper you chose. Those outputs are legal-looking and wrong for almost every document. Pass an object whose keys are the tag names you want.

What will not round-trip

Attribute order, empty-element style, and the declaration are the builder’s. A null will not return as null. A single repeated tag’s array versus object distinction is reintroduced only if you build repeated elements and parse them with the XML-to-JSON page. Mixed content that lost its word spacing on the way into JSON cannot be repaired here. Use this page for an object that already uses element-shaped keys. Do not feed it a scalar and expect a document.

Privacy

Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.