{ }JSONKit.tools

JSON to XML Converter

Paste JSON and get formatted XML back. Keys prefixed with @ become attributes, and an array gets wrapped in a root element so the document is well-formed.

XML → JSON⇄JSON → XML

JSON

XML

Waiting for input…

About this tool

Converting JSON to XML means answering two questions the source does not: what the root element is, and which values are attributes. This tool uses one root element per document — the single top-level key if there is one, otherwise a wrapping <root> — and treats any key beginning with @ as an attribute. That is the same convention the XML to JSON page reads, so a document can make the round trip and come back the way it started.

How to use it

  1. 1Paste your JSON into the left panel.
  2. 2Prefix a key with @ if that value should become an attribute rather than a child element.
  3. 3Copy the XML — it comes out indented and ready to paste into a config or a request body.

Frequently asked questions

›My JSON is an array — what becomes the root element?

XML needs exactly one root element and an array has none, so the document is wrapped in <root>. An object with a single top-level key keeps that key as the root instead.

›How do I produce attributes instead of child elements?

Prefix the key with @: { "user": { "@id": 7, "name": "Ada" } } becomes <user id="7"><name>Ada</name></user>. That is the same convention the XML to JSON page uses, so the two round-trip.

›What happens to keys that are not valid XML names?

XML element names cannot start with a digit or contain spaces. Keys like "2020" or "first name" produce a document that is not well-formed — rename them in the JSON first.

›Is null represented?

It becomes an empty element. XML has no null, so an empty element and an explicit null cannot be told apart on the way back.

›Why would I still need XML?

Plenty of systems only speak it: SOAP services, RSS and sitemap feeds, Android and Java configuration, Office document formats, and older enterprise integrations.