Studio ↗

Convert XML to clean, structured JSON instantly.

Paste raw XML and get formatted, minified, or tree-viewable JSON in real time. Private, zero-upload, and runs entirely in your browser.

✓

Valid XML

29 lines · 1.0 KB

XML input1.0 KB · 29 lines
JSON outputjson
{
  "?xml": {
    "@_version": 1,
    "@_encoding": "UTF-8"
  },
  "project": {
    "metadata": {
      "version": "2.4.0",
      "author": "JSONGlow Engineering",
      "license": "MIT",
      "released": true
    },
    "features": {
      "feature": [
        {
          "name": "XML to JSON Converter",
          "category": "data-transformation",
          "latencyMs": 1.2,
          "description": "Fast, browser-based XML parsing with zero server upload.",
          "@_id": "f-01",
          "@_enabled": true
        },
        {
          "name": "JSON Tree Viewer",
          "category": "visualization",
          "latencyMs": 0.8,
          "description": "Collapsible hierarchical navigation for large objects.",
          "@_id": "f-02",
          "@_enabled": true
        },
        {
          "name": "Cloud Sync",
          "category": "storage",
          "latencyMs": 0,
          "description": "Privacy-first mode ensures no remote storage is used.",
          "@_id": "f-03",
          "@_enabled": false
        }
      ]
    },
    "@_name": "JSONGlow",
    "@_status": "active"
  }
}

# 44 lines · 1,113 chars

⚡

JSONGlow's XML to JSON converter is a free, client-side utility that transforms XML documents into structured, formatted JSON with full support for attributes, CDATA, and typed primitives.

Data Modernization

Transforming legacy XML into modern JSON structures.

XML and JSON are the two predominant data interchange formats across software engineering, but migrating between legacy SOAP/XML systems and modern REST/GraphQL APIs requires careful translation of attributes, namespaces, and node hierarchies.

Unlike JSON, XML documents contain both child elements and tag attributes (e.g., <book id="12">). JSONGlow gives you granular control over how attributes are represented in the resulting JSON, allowing you to choose between @_ prefixes, @ prefixes, unprefixed property merging, or complete attribute stripping. Once converted, you can beautify the output using our JSON Formatter or check syntax with the JSON Validator.

Repeated sibling tags are automatically grouped into clean JSON arrays, while numeric and boolean strings can be automatically cast into native JSON primitives. CDATA sections are preserved without corruption, making the tool ideal for feeds, SVG manipulation, and configuration migrations.

Because all parsing executes locally inside your web browser using optimized client-side parsers and Web APIs, confidential enterprise XML files and proprietary database exports remain completely secure. If you need the reverse transform, check out our JSON to XML Converter or convert configurations to YAML with YAML to JSON.

Workflow Guide

How to convert XML to JSON in 3 steps

1. Paste Raw XML01

Input XML document

Paste your SOAP payload, RSS feed, SVG XML, or configuration file into the left editor pane.

2. Choose Attribute Style02

Configure prefix & types

Select how attributes should be prefixed (`@_`, `@`, none, or ignored) and toggle automatic numeric/boolean type casting.

3. Export Formatted JSON03

Copy or download

Click 'Copy' to grab the formatted JSON, or click 'Download .json' to save the file locally.

Practical Demonstration

XML to JSON Parsing Example

See how XML attributes, repeated child tags, and typed text values map to clean JSON objects and arrays.

Raw XML Input (Books Catalog)
Input
<?xml version="1.0" encoding="UTF-8"?>
<catalog id="lib-99">
  <book id="bk101" available="true">
    <title>Design Patterns</title>
    <price>49.99</price>
  </book>
  <book id="bk102" available="false">
    <title>Refactoring</title>
    <price>54.95</price>
  </book>
</catalog>
Converted JSON Output (@_ Prefix + Auto Types)
Processed
{
  "catalog": {
    "@_id": "lib-99",
    "book": [
      {
        "@_id": "bk101",
        "@_available": true,
        "title": "Design Patterns",
        "price": 49.99
      },
      {
        "@_id": "bk102",
        "@_available": false,
        "title": "Refactoring",
        "price": 54.95
      }
    ]
  }
}
Key Difference:Repeated `<book>` tags are grouped into a JSON array, XML attributes are cleanly prefixed with `@_`, and price/available strings are parsed to native numbers and booleans.

XML Pitfalls & Edge Cases

Common XML syntax & conversion challenges

!

Unclosed or mismatched XML tags

Why it happens: XML is strictly hierarchical; forgetting a closing tag like `</book>` or mismatched case `<Title></title>` crashes standard XML parsers.

Solution:The editor displays live XML parsing errors with line and column positions to help you fix structural mistakes.
!

Unescaped XML entities (&, <, >)

Why it happens: Raw ampersands (`&`) or unescaped angle brackets inside XML text nodes violate XML specs (e.g. `AT&T` must be written as `AT&amp;T`).

Solution:Escape entity characters or wrap text inside `<![CDATA[ ... ]]>` blocks.
!

Attribute naming collisions with child elements

Why it happens: If an element has both an attribute `id="1"` and a child `<id>1</id>`, naive converters can overwrite one of the values.

Solution:JSONGlow uses attribute prefixes (like `@_id`) to cleanly isolate attributes from child elements.

Core Capabilities

Comprehensive XML to JSON processing

▸

Configurable Attribute Prefixes

Choose between `@_`, `@`, none, or ignore mode to match your API naming conventions.

▸

Automatic Array Grouping

Repeated sibling XML elements collapse seamlessly into typed JSON arrays.

▸

Primitive Type Inference

Automatically casts numeric and boolean strings into native JSON numbers and booleans.

▸

CDATA & Entity Preservation

Safely parses CDATA blocks and standard XML entities without corrupted characters.

▸

Tree View & Full-Screen

Inspect large converted JSON structures with collapsible tree nodes in distraction-free mode.

▸

100% Client-Side Privacy

No server uploads. Safe for confidential SOAP responses, RSS feeds, and enterprise XML.

Frequently Asked Questions

Common questions answered.

Need more help? Our tools execute entirely in your browser without transmitting any payload to remote servers.

How are XML attributes converted to JSON?+

Attributes are preserved as object properties prefixed with `@_` by default (e.g. `<book id="12">` becomes `{ "@_id": 12 }`). You can customize this to use `@`, no prefix, or ignore attributes completely via the toolbar selector.

How does the converter handle repeated XML child tags?+

When multiple sibling tags share the same name (e.g. `<item>1</item><item>2</item>`), the converter automatically bundles them into a clean JSON array `"item": [1, 2]`.

Are numbers and booleans converted from text to native JSON types?+

Yes. With 'Types: Auto' enabled, numeric and boolean strings are automatically parsed to native numbers and booleans. Switch to 'Types: String' if you prefer raw string preservation.

How are CDATA blocks handled during conversion?+

CDATA blocks (e.g., `<![CDATA[<html>...</html>]]>`) are cleanly extracted as plain string content without unescaping or corrupting the text.

Is my XML data uploaded to any server during conversion?+

No. The entire conversion process runs purely inside your browser using fast, client-side Web APIs. Nothing is transmitted over the network or stored on any remote server.

Explore More Tools & Guides

The JSONGlow developer kit.