>_devtools

JSON to XML Converter

Build XML from JSON with attribute and text-node conventions, a root element, and an optional declaration.

What this does

Builds XML from JSON. Object keys become elements, arrays become repeated elements, and scalar values become text, which is escaped for you.

Conventions

  • Keys that start with the attribute prefix (@_ by default) become attributes, so {"a": {"@_id": "1", "#text": "x"}} becomes<a id="1">x</a>. Change the prefix or the text key to match what you get back from the XML to JSON converter.
  • XML needs exactly one root element. A JSON object with a single key uses that key as the root; anything else, such as several keys, an array, or a scalar, is wrapped in the root element you name.
  • An array at the top level becomes <item> elements under that root.
  • Turn off "Self-close empty elements" to write empty elements as <a></a> instead of <a/>.

Errors

Keys that are not legal XML names, such as ones with spaces, are reported instead of producing broken XML. Invalid JSON shows the parser's message with a position when it has one.

Privacy

Everything runs in your browser. Your input is never uploaded, stored, or put in the URL.