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.
<?xml version="1.0" encoding="UTF-8"?>
<root>
<user>
<id>42</id>
<name>Ada</name>
<roles>admin</roles>
<roles>founder</roles>
</user>
</root>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.
- 01
Paste JSON
Drop any valid JSON object. Arrays become repeated tags using their parent key name.
Inputs parse through the native
JSON.parsereviver chain — strict RFC 8259. Any syntax error returns line and column for the exact offending byte.jsonarraysRFC 8259JSON.parsestrictinput · raw.json · RFC 8259{"name":"Ada"}loaded · parsed RFC 8259RFC 8259 · ready - 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.stringifyliveroot · options<config> · live<config>...</config>
options applied · livelive - 03
Choose indent
2 or 4 spaces. The XML declaration always uses UTF-8.
Large documents stream through a
useMemowith stable hashing so options re-apply instantly — no full re-parse if only formatting changes.2sp4spmemoisedinstantdiff-friendlyoutput · rendered.xml · ready<?xml version="1.0" encoding="UTF-8"?> <root> <name>Ada</name> </root>
rendered · livediff-friendly - 04
Copy or download .xml
Round-trip back with an XML parser. Entity escapes (
&,<,>,",') are applied automatically.Download is a
Blobwithapplication/json; copy uses the Async Clipboard API. Both round-trip identically to what the page rendered.entitiessafeclipboardblob.jsonexport · copiedready · done✓ Copied ✓ Saved
shipped · ready to shipsuccess
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.
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 scanRSS / 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 diffsOffice documents
DOCX / XLSX are zipped XML. Drop in JSON config for templated documents.
RFC 8259 validSitemaps
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 safeCisco / 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-friendlyETL 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-readyFrequently asked questions
Something missing?
Tell us what you need. We ship the top requests every two weeks.