DevToolBoxGRÁTIS
Blog

XML to JSON Converter

Convert XML to JSON online. Transform XML documents to JSON with attribute handling, nested elements, and array detection. Free and instant.

About XML to JSON Conversion

XML and JSON are two of the most common data interchange formats. While XML uses tags and attributes, JSON uses key-value pairs and arrays. Converting XML to JSON is useful when migrating legacy systems, consuming SOAP APIs, or processing XML feeds in modern JavaScript applications. This tool parses XML and converts it to a structured JSON representation where elements become objects, attributes are prefixed with @, text content is stored as #text, and repeated elements automatically become arrays. It handles CDATA sections, self-closing tags, and nested structures. All processing happens in your browser.

𝕏 Twitterin LinkedIn

Avalie esta ferramenta

3.7 / 5 · 75 avaliações

Fique atualizado

Receba dicas de dev e novos ferramentas semanalmente.

Sem spam. Cancele a qualquer momento.

Enjoy these free tools?

Buy Me a Coffee

How to Use

  1. Paste your XML content into the input panel
  2. Click Convert to generate JSON
  3. Review the JSON output with attributes and text
  4. Copy the JSON for use in your application

Common Use Cases

  • Converting SOAP API responses to JSON for modern apps
  • Migrating XML configuration files to JSON format
  • Processing RSS/Atom feeds as JSON data
  • Transforming XML exports from legacy systems

Frequently Asked Questions

How are XML attributes handled?
Attributes are prefixed with @ in the JSON output. For example, <item id="1"> becomes {"@id": "1"}.
How is text content represented?
Text content within elements is stored as #text. If an element has both attributes and text, both are preserved: {"@attr": "val", "#text": "content"}.
Does it handle repeated elements?
Yes. When multiple sibling elements share the same tag name, they are automatically grouped into a JSON array.
Does it support CDATA sections?
Yes. CDATA sections are parsed and their content is included as text in the JSON output.