All articles
DeveloperJul 31, 2026 · 3 min read

How to Convert JSON to XML (and XML to JSON)

Plenty of APIs and legacy systems still speak XML, while most modern code works in JSON. Converting between the two by hand is tedious and error-prone. Here's how to convert JSON to XML — or XML to JSON — in one click, free and entirely in your browser.

Convert in three steps

  1. Open the JSON to XML converter.
  2. Pick a direction — JSON → XML or XML → JSON.
  3. Paste your data; the converted output appears instantly, ready to copy.

There's a Swap button too, so you can round-trip data and flip direction in one click.

How attributes are handled

XML has both elements and attributes; JSON doesn't distinguish them. To convert losslessly, XML attributes map to JSON keys prefixed with @_ (and back again). So <item id="3"> becomes { "item": { "@_id": 3 } }, preserving the attribute when you convert either way.

Is my data safe?

Yes — the conversion runs entirely in your browser, so whatever you paste never leaves your device. That makes it safe for real payloads and config, not just test data.

Other conversions

Working with other formats? There's JSON ↔ YAML, JSON to CSV, and a JSON formatter/validator for tidying and checking JSON. See all the developer tools.

FAQ

Is my data uploaded anywhere?

No — conversion happens locally in your browser.

Are nested structures kept?

Yes — nested objects/elements and arrays are preserved in both directions, along with attributes.

What if my input is invalid?

You'll get an error message so you can fix the JSON or XML and try again.