XML 1.0 · UTF-8 · escape-safe

Convert JSON to well-formed XML

Object keys become element names, arrays become repeated tags. All entities are properly escaped — drop into legacy SOAP, RSS, or any XML-only pipeline.

JSON → XML Workspace
Input size
86 B
7 lines
Output size
161 B
9 lines
Root
<root>
2 sp indent
Status
Valid
XML 1.0 · UTF-8
RootIndent
input · json
output · xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <user>
    <id>42</id>
    <name>Ada</name>
    <roles>admin</roles>
    <roles>founder</roles>
  </user>
</root>
Quick Start

How to convert JSON to XML

Modernized JSON sometimes needs to flow into older XML-only systems — SOAP services, RSS feeds, configuration formats. This converter emits well-formed XML with proper entity escaping.

  1. 01

    Paste JSON

    Drop any valid JSON object. Arrays become repeated tags using their parent key name.

    Inputs parse through the native JSON.parse reviver chain — strict RFC 8259. Any syntax error returns line and column for the exact offending byte.

    jsonarraysRFC 8259JSON.parsestrict
    input · raw.json · RFC 8259
    {"name":"Ada"}
    loaded · parsed RFC 8259RFC 8259 · ready
  2. 02

    Pick a root element name

    Defaults to root. Choose something domain-specific (response, config, feed).

    Indent options run through JSON.stringify(value, null, n); the second argument lets you sort, transform, or omit keys via a replacer if you ever wire one in.

    rootnamingindentJSON.stringifylive
    root · options<config> · live
    <config>...</config>
    options applied · livelive
  3. 03

    Choose indent

    2 or 4 spaces. The XML declaration always uses UTF-8.

    Large documents stream through a useMemo with stable hashing so options re-apply instantly — no full re-parse if only formatting changes.

    2sp4spmemoisedinstantdiff-friendly
    output · rendered.xml · ready
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
      <name>Ada</name>
    </root>
    rendered · livediff-friendly
  4. 04

    Copy or download .xml

    Round-trip back with an XML parser. Entity escapes (&, <, >, ", ') are applied automatically.

    Download is a Blob with application/json; copy uses the Async Clipboard API. Both round-trip identically to what the page rendered.

    entitiessafeclipboardblob.json
    export · copiedready · done
    ✓ Copied
    ✓ Saved
    shipped · ready to shipsuccess
Pro tips

Production-grade JSON, the right way

Stick to RFC 8259

Strict JSON has no NaN, Infinity, comments, or trailing commas. If you need those, look at JSON5 or JSON Repair.

Preserve key order for diffs

JavaScript preserves insertion order, but two parsers shouldn’t be assumed equal. Use Sort JSON Keys before diffing or hashing.

Big integers lose precision

JS numbers lose precision past 2^53−1. Transport large IDs as strings or use BigInt.

Escape inside HTML

When inlining JSON inside <script>, escape </ to <\/ so HTML parsing doesn’t close your tag early.

Validate at boundaries

Trust the wire as little as possible. Run incoming JSON through a schema (Zod / Pydantic) before it touches business logic.

Minify in production

Minify removes whitespace; gzip removes redundancy. Together they typically shrink JSON payloads 70–85% over the wire.

Use Cases

When to convert JSON to XML

Anywhere downstream systems require XML and your data is JSON.

Legacy SOAP services

SOAP envelopes wrap XML payloads — wrap your JSON before sending. Output round-trips losslessly through JSON.parse + JSON.stringify, so the file you save is byte-identical to what you see. Streaming parsers, jq pipelines, and Postgres jsonb columns all accept the result without complaint.

10× faster to scan

RSS / Atom feeds

Build feeds from CMS data exported as JSON. Pairs perfectly with sort-keys + diff for review-friendly fixtures in CI. Whitespace-only churn disappears and reviewers see real changes, which keeps PR comments focused on logic rather than indentation.

cleaner PR diffs

Office documents

DOCX / XLSX are zipped XML. Drop in JSON config for templated documents.

RFC 8259 valid

Sitemaps

Generate sitemap XML from a route-list JSON. Re-parses on every keystroke so syntax errors are caught at the exact character. Strict RFC 8259 — no trailing commas, no comments, no unquoted keys — keeps downstream parsers happy.

round-trip safe

Cisco / network gear

Some networking APIs and tools expect NETCONF/YANG-style XML. Streams large documents without a server round-trip — privacy stays in the tab. Heavy parsing runs through useMemo so even 5 MB payloads keep the editor responsive.

schema-friendly

ETL pipelines

Convert JSON event streams to XML for archive or legacy consumers. Output is byte-stable: same input plus same options always produces identical bytes, ideal for content-addressed caches and snapshot tests. Downloads ship with the application/json MIME so editors apply syntax highlighting.

production-ready
FAQ

Frequently asked questions

Each element is emitted as a repeated tag using the parent key name. [{id:1},{id:2}] under "item" produces two <item> elements.
Yes — use the Root field in the toolbar. Defaults to "root".
Yes — &, <, >, ", and ' are all escaped to XML entities.
Not yet — only element-based emission. For attribute-heavy structures, post-process with an XSLT or hand-edit.
No. All conversion runs locally.
Suggest a tool

Something missing?

Tell us what you need. We ship the top requests every two weeks.

Sent straight to the maintainers · no account needed
47 in queue·8 shipped this month
Request queued. Thanks!