XML → JSON Converter

Convert XML to JSON. Paste XML or import a file; adjust options, preview, copy, and download.

XML
Paste XML directly or import a .xml or .txt file from this device.
JSON
JSON output updates as soon as the input contains valid XML.
{
  "_declaration": {
    "_attributes": {
      "version": "1.0",
      "encoding": "utf-8"
    }
  },
  "note": {
    "_attributes": {
      "importance": "high",
      "logged": "true"
    },
    "title": {
      "_text": "Happy"
    },
    "todo": [
      {
        "_text": "Work"
      },
      {
        "_text": "Play"
      }
    ]
  }
}
Options
Adjust how XML is parsed before you copy or download the converted JSON.

Choose 0 for compact output or 1-8 for pretty-printed indentation.

What this tool is for

Use this tool when you need to turn valid XML into JSON that is easier to scan, share, or commit. Everything runs locally in the browser.

Where it helps

  • Converting API examples into JSON for docs or config files.
  • Rewriting copied XML payloads into a format that is easier to diff by eye.
  • Preparing structured content for tools and workflows that expect JSON.

What to watch for

  • Input must be valid XML in this tool.
  • The converter preserves data structure, but JSON presentation can still differ from hand-written style.
  • If you need to go the other direction, use the JSON to XML converter instead.