elefcode

JSON tool

JSON to XML — free online tool

Convert any JSON document to well-formed XML in your browser — proper entity escaping, nested elements, attributes via the `@` prefix.

What does this do?

XML is still ubiquitous in enterprise integrations, SOAP services, SVG, and many legacy APIs. This converter emits well-formed XML with a UTF-8 declaration, escapes the five XML entities (`<`, `>`, `&`, `"`, `\'`), validates element names, and supports the common JSON-to-XML conventions used by libraries like Newtonsoft.Json and xml2js.

When to use it

  • Adapt JSON API output for a SOAP/XML downstream system
  • Convert configuration to XML for tools that require it
  • Generate test XML fixtures from JSON examples
  • Quick-check what JSON would look like as XML

Tip

Object keys become element names. Arrays repeat the parent element. A key starting with `@` becomes an attribute on the parent element, and a key named `#text` becomes the text node — the same convention used by xml2js and most JSON↔XML libraries.

Example: Book record with attributes

Input — JSON

{
  "book": {
    "@id": "b-42",
    "@lang": "en",
    "title": "The Pragmatic Programmer",
    "authors": [
      { "@role": "primary", "#text": "David Thomas" },
      { "@role": "co",      "#text": "Andrew Hunt" }
    ],
    "year": 1999
  }
}

Output

<?xml version="1.0" encoding="UTF-8"?>
<book id="b-42" lang="en">
  <title>The Pragmatic Programmer</title>
  <authors role="primary">David Thomas</authors>
  <authors role="co">Andrew Hunt</authors>
  <year>1999</year>
</book>

More JSON tools