JSON ↔ XML Converter

Convert between JSON and XML. JSON to XML wraps each key in an element; arrays repeat the parent element name. XML to JSON collapses single-child elements into values and groups repeated elements into arrays. Round-trip preserves structure for most realistic shapes.

How to use the JSON ↔ XML Converter

Pick a direction, paste content, click Convert. Arrays in JSON repeat the parent element in XML (so {items: [1,2]} becomes <items>1</items><items>2</items>). XML-to-JSON detects repeated child elements and groups them into JSON arrays.

Converting between JSON and XML

JSON and XML cover the same ground — structured, hierarchical data — but plenty of systems still speak only one of them: SOAP services, RSS and sitemap feeds, and many enterprise and configuration formats are XML, while most modern APIs are JSON. The mapping between them is not quite one-to-one, mainly because of how each represents a list.

This converts both directions: JSON to XML wraps each key in an element and repeats the parent element for array items, while XML to JSON groups repeated elements back into arrays and collapses single children into values. You can set the root element and indent. For flattening JSON into a URL query string instead of XML, the JSON to query string tool covers that, and to tidy existing XML the XML formatter reindents it.

Common use cases

  • Feed a SOAP service — turn a JSON object into the XML an older API expects.
  • Build a feed — convert JSON records into XML for RSS or a sitemap.
  • Read XML as JSON — parse an XML response into JSON your code can use.
  • Set the root — choose the wrapping element and indentation.
  • Bridge formats — move data between an XML system and a JSON one.

Frequently asked questions

How are JSON arrays represented in XML?

Each array item repeats the parent element, so a list becomes several sibling elements with the same name.

Does XML to JSON handle repeated elements?

Yes — repeated sibling elements are grouped into a JSON array, and single children collapse into values.

Can I set the root element name?

Yes — the root element and the indent width are both configurable.

How do I just reformat XML?

Use the XML formatter to reindent and tidy existing XML.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: