Skip to main content
Z

XML to JSON Converter — Fast Browser-Based XML Parsing & Output

Convert XML to JSON in your browser. Native DOMParser with configurable attribute prefix, text key, and compact mode.

Free No signup Client-side Privacy friendly Updated

How to use

  1. 1 Paste valid XML. The browser parses it with the native DOMParser.
  2. 2 Choose attribute prefix (default `@`) and text key (default `#text`).
  3. 3 Toggle Compact to collapse leaf elements (no attrs, no children) to plain strings.
  4. 4 Copy or download the JSON tree.

Why use this tool

  • Native DOMParser — no external XML library bundled.
  • Attributes become keys prefixed with `@`. Mixed text + children stored under `#text` key.
  • Repeated child tags collapse into arrays automatically.
  • Pure client-side — your data stays in your browser.

Frequently asked questions

How are attributes represented?

Each attribute becomes a key prefixed with `@` (configurable). `<note to="Tove">` becomes `{"@to": "Tove"}`.

What if a tag repeats inside its parent?

Repeated children with the same tag name collapse into a JSON array.

How is mixed content handled?

Text content sits next to children under the `#text` key (configurable).

Need to go the other way?

See <a class="text-brand-600 hover:underline" href="/json-to-xml">JSON to XML</a>, or <a class="text-brand-600 hover:underline" href="/xml-formatter">XML Formatter</a> for pretty-print only. JSON output works directly with <a class="text-brand-600 hover:underline" href="/json-formatter">JSON Formatter</a>.

What is XML to JSON Converter?

An XML to JSON Converter is a tool that transforms XML markup into equivalent JSON data, mapping elements, attributes, and text content into nested objects and keys. It runs in the browser using the native DOMParser, with configurable options including an attribute prefix, a dedicated text key, and a compact output mode for cleaner, more concise results.

Features

Elements to objects

Nested elements become nested objects; repeated elements become arrays.

Configurable output

Set an attribute prefix and text key, or use compact mode for cleaner JSON.

100% private

Uses the native parser locally — your XML never reaches a server.

Example

Input

<note><to>Ann</to><priority>1</priority></note>

Output

{
  "note": {
    "to": "Ann",
    "priority": "1"
  }
}

Common use cases

  1. 1

    Consume XML in JS

    Turn an XML API response or RSS feed into JSON your code can index.

  2. 2

    Migrate legacy data

    Convert XML config or exports into JSON for modern tooling.

  3. 3

    Inspect XML structure

    Read tangled XML as indented JSON to understand its shape.

Summary

Zerethon's XML to JSON converter parses XML with the browser's native DOMParser and emits equivalent JSON, mapping elements, attributes, and text into nested objects. Attribute prefix, text key, and a compact mode are configurable. Nothing is uploaded.

Category
Developer
Pricing
Free
Privacy
Browser-based
Signup
Not required

References

Privacy

Your data never leaves your browser unless explicitly stated. XML to JSON Converter runs entirely client-side — no server upload, no logging, no tracking of your input.

Compare

Learn the basics

How-to guides

Related tools

Build, share, and grow on Zerethon Social

Free signup. Earn points, collect achievements, and connect with creators worldwide.

Sign up free