Skip to main content
KalkuNet

JSON to XML — Converter with Attributes, Text and Repeated Elements

Transform JSON hierarchies cleanly into well-formed indented XML nodes.

Runs in your browserDeveloper · JSON, YAML, TOML, XML & CSV Converters
Layout:
  • The inverse of xmltodict: "@name" becomes an attribute, "#text" text, arrays repeated elements and null an empty element. & < > and quotes are escaped, and tabs and newlines in attributes are written as &#9; and &#10; so they survive.

When to use the JSON Object to XML Element Converter

  • The inverse of xmltodict

    "@name" keys become attributes, "#text" becomes text, arrays become repeated elements and null an empty element. xmltodict reads the output back as the same data.

  • Safe escaping

    &, <, > and quotes are escaped; tabs, newlines and CRs in attributes are written as &#9;, &#10; and &#13; so attribute normalisation does not erase them when the file is read again.

  • Names and characters checked

    Keys that are not valid XML names (starting with a digit, holding spaces or empty) and control characters XML 1.0 forbids are reported with their path instead of producing broken XML.

  • One root element

    A JSON object with one key becomes the root element directly. Other shapes, such as arrays or objects with several keys, are wrapped in a root element whose name you can set.

Frequently asked questions

How are numbers and booleans written?

Numbers are written exactly as in the JSON without rounding, and booleans as true or false.

Can it produce CDATA or comments?

No. Text is always escaped, which a parser reads exactly like CDATA.

What about keys with a colon?

Keys such as atom:link are written as prefixed element names. Add an @xmlns:atom attribute on a parent element too, so the document is valid under the namespace rules.

Why are arrays inside arrays rejected?

XML has no direct form for unnamed nested arrays. Wrap each inner array in an object with an element name.

Is my data uploaded?

No. The conversion runs in your browser.

Learn more