pulsa ⌘K para cambiar de herramienta
FORMAT & CONVERT

Convertidor XML → JSON

Convierte documentos XML al formato JSON.

local
xml-json

Attributes are prefixed with @. Conversion runs entirely in your browser.

§01 ACERCA DE ESTA HERRAMIENTA

Overview

XML is still everywhere — RSS feeds, SOAP payloads, sitemaps, legacy APIs — but modern tooling wants JSON. This converter parses XML with your browser’s native DOMParser and emits pretty-printed JSON (2-space indent). Attributes are kept with an @ prefix, mixed text is stored as #text, and repeated sibling tags become arrays.

How to use

  1. Paste your document into the XML field. Conversion runs as you type.
  2. Read the result from the JSON field. Malformed XML shows an Invalid XML error between the fields instead.

Examples

  • <user id='1'><name>Alice</name></user>
{
  "user": {
    "@id": "1",
    "name": "Alice"
  }
}
  • <list><item>a</item><item>b</item></list> → the two item elements merge into the array ["a", "b"].

Notes

The mapping is one-way (XML → JSON) and lossy by nature: comments, processing instructions, CDATA distinctions, and namespace declarations beyond plain attribute form are not carried over. An element with neither attributes nor children converts to a plain string, so <port>8080</port> yields "8080" — a string, not a number.

FAQ
Is my XML sent to a server?
No. Parsing uses your browser's built-in DOMParser and the JSON is produced locally. Nothing is uploaded.
How are XML attributes represented in the JSON?
Attributes become keys prefixed with @ (for example, id="1" becomes "@id": "1"), and text inside an element that also has attributes is stored under the #text key.
What happens with repeated elements?
When the same tag appears more than once under a parent, the values are automatically collected into a JSON array, so lists of items convert naturally.