# XML para JSON

> Converte elementos e atributos XML em JSON.

[Open tool](https://www.toolcabana.com/pt-br/xml-to-json) · [Desenvolvimento e dados](https://www.toolcabana.com/pt-br/category/developer-and-data)

Tool ID: xml-to-json. Requested language: pt-BR. Description language: pt-BR. 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 (pt-BR)

Converte elementos e atributos XML em JSON.

## Steps (pt-BR)

1. Cole a fonte no editor de entrada ou carregue o exemplo integrado.
2. Verifique o formato de origem antes de executar a operação.
3. Execute a conversão de XML para JSON, revise a saída e use os controles disponíveis para copiar ou baixar.

## Settings

No additional settings.

## Limitations (pt-BR)

As operações de texto aceitam geralmente até 2,000,000 caracteres. Analisadores, geradores e fórmulas individuais aplicam limites adicionais mostrados pelos seus controles.

## Example input

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

## Privacy and connections (pt-BR)

Esta operação processa sua fonte no seu navegador. Copiar e baixar são ações explícitas; a entrada de origem não é salva em conta nem em histórico.

## Questions (pt-BR)

### 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.

### Onde minha entrada é processada?

Esta operação processa sua fonte no seu navegador. Copiar e baixar são ações explícitas; a entrada de origem não é salva em conta nem em histórico.

### Quais são os limites de entrada?

As operações de texto aceitam geralmente até 2,000,000 caracteres. Analisadores, geradores e fórmulas individuais aplicam limites adicionais mostrados pelos seus controles.

## Related tools

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