snaptools
X
XML to JSON error
⌃⏎ run · clear · / focus input
// about this tool

XML to JSON Online

Updated 2026-07-09

Convert XML to JSON online for free, instantly in your browser. Paste any XML — elements, attributes, nested nodes, and repeated tags — and SnapTools produces clean, pretty-printed JSON ready to copy or download. Nothing is uploaded; the conversion runs locally.

XML still shows up in APIs, RSS feeds, and legacy systems, but most modern tooling speaks JSON. This converter bridges the two, preserving attributes (as @-prefixed keys), repeated elements (as arrays), and mixed text, so you keep the structure while moving to a JSON-friendly format.

// how to use

  1. 1 Paste your XML into the input panel.
  2. 2 SnapTools converts it to clean, pretty-printed JSON as you type.
  3. 3 Copy or download the JSON for your API, app, or tests.

// examples

XML to JSON
Input
<user><name>Alice</name><age>30</age></user>
Output
{
    "user": {
        "name": "Alice",
        "age": "30"
    }
}

// common uses

Turning XML API responses into JSON Converting RSS or config XML for JSON tooling Migrating legacy XML data to JSON Inspecting the structure of an XML document

// faq

Attributes are kept and prefixed with an @ in the JSON. For example, a book element with id="1" becomes an "@id" key with the value "1" alongside the element's child values.
When an element name appears more than once inside the same parent, those values are grouped into a JSON array, so the structure is preserved.
When an element has both text and child elements, the text is stored under a "#text" key so nothing is lost.
XML has no types, so all text values come through as JSON strings. Convert specific fields afterwards if you need real numbers or booleans.
No — the conversion runs in your browser, so nothing leaves your machine.

Use this via API

Get a free API key →
curl -X POST https://snaptools.dev/api/v1/tools/xml-to-json \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"xml":"<user><name>Alice</name><age>30</age></user>"}'
Esc
↑↓ navigate open Esc close