# XML a JSON

> Convierte elementos y atributos XML en JSON.

[Open tool](https://www.toolcabana.com/es/xml-to-json) · [Desarrollo y datos](https://www.toolcabana.com/es/category/developer-and-data)

Tool ID: xml-to-json. Requested language: es. Description language: es. Complete guide translation: yes.

## Overview (en)

XML to JSON converts well-formed XML into formatted JSON that keeps both elements and attributes. Attributes appear as keys prefixed with @_, repeated sibling elements become arrays, and element text that looks like a number is converted to a number. Invalid XML is reported with a line number, and DOCTYPE or entity declarations are refused.

## Supported tasks (es)

Convierte elementos y atributos XML en JSON.

## Steps (es)

1. Pega la fuente en el editor de entrada o carga el ejemplo integrado.
2. Comprueba el formato de origen antes de ejecutar la operación.
3. Ejecuta la conversión de XML a JSON, revisa la salida y usa los controles disponibles para copiar o descargar.

## Settings

No additional settings.

## Limitations (es)

Las operaciones de texto aceptan generalmente hasta 2,000,000 caracteres. Los analizadores, generadores y fórmulas individuales aplican límites adicionales que muestran sus controles.

## Example input

```text
<root><name>ToolCabana</name><count>2</count></root>
```

## Privacy and connections (es)

Esta operación procesa su fuente en tu navegador. Copiar y descargar son acciones explícitas; la entrada de origen no se guarda en una cuenta ni en un historial.

## Questions (es)

### How are XML attributes shown in JSON?

Attributes are kept and appear on their element object as keys starting with @_, so id="1" becomes "@_id": "1". Attribute values stay strings.

### What happens to repeated XML elements when converting to JSON?

Sibling elements with the same name are grouped into a JSON array under that name. A single occurrence stays a plain value or object.

### Why did XML to JSON remove leading zeros?

Element text that looks like a number is parsed as a JSON number, so a value such as 007 becomes 7. Keep codes as attributes if their exact text matters.

### ¿Dónde se procesa mi entrada?

Esta operación procesa su fuente en tu navegador. Copiar y descargar son acciones explícitas; la entrada de origen no se guarda en una cuenta ni en un historial.

### ¿Cuáles son los límites de entrada?

Las operaciones de texto aceptan generalmente hasta 2,000,000 caracteres. Los analizadores, generadores y fórmulas individuales aplican límites adicionales que muestran sus controles.

## Related tools

- [YAML to JSON](https://www.toolcabana.com/es/yaml-to-json)
- [JSON to YAML](https://www.toolcabana.com/es/json-to-yaml)
- [CSV to JSON](https://www.toolcabana.com/es/csv-to-json)
- [JSON to CSV](https://www.toolcabana.com/es/json-to-csv)
