TontonTools

XML to JSON

Convert XML to JSON — legacy data into the format modern code wants.

100% Free No signup Privacy-friendly Web Development
Updated Sep 2026

Share X / Twitter Facebook LinkedIn WhatsApp

How to use XML to JSON

  1. Paste your XML — a SOAP response, RSS feed or export.
  2. Read the JSON output — elements as keys, repeats as arrays, attributes @-prefixed.
  3. Watch the single-item case: one occurrence converts as an object, several as an array — normalize downstream if feeds vary.
  4. Pipe it onward — into the JSON Viewer, your code or any JSON-native tool.

What is XML to JSON?

An XML to JSON converter restructures tagged XML into JSON objects: elements become keys, text content becomes values, repeated sibling elements become arrays, and attributes map in by convention (typically @-prefixed keys). <user><name>Ada</name></user> becomes {"user": {"name": "Ada"}}.

This is the modernization direction: the durable XML layer — SOAP services, RSS/Atom feeds, sitemaps, enterprise exports, configuration from the Java world — keeps producing XML, while everything you want to do with the data (JavaScript, APIs, JSON tooling) wants JSON. The converter is the adapter between the eras.

About the XML to JSON

Paste XML and get the JSON equivalent instantly — nesting preserved, repeated elements gathered into arrays, attributes mapped by convention.

Typical jobs: consuming a SOAP or XML-RPC response inside a modern JavaScript/Python stack, turning an RSS feed into JSON a frontend can render, converting enterprise or government data exports for JSON-native pipelines, and migrating XML configs to JSON formats. Once converted, the whole JSON toolbox applies — the Viewer's tree for exploration, the Validator, jq-style processing.

The mapping honesty: XML carries things JSON doesn't (attributes, namespaces, comments, mixed text-and-element content), so conventions bridge the gap — attributes become @key entries, text alongside children becomes a #text key, and the single-vs-array ambiguity (one <item> converts as an object; two convert as an array) is worth normalizing in code that consumes varying feeds.

Frequently Asked Questions

By convention as prefixed keys: <user id="7">Ada</user> → {"user": {"@id": "7", "#text": "Ada"}}. JSON has no attribute concept, so converters invent one — @ and #text are the most common convention.
Structure inference: two <item> siblings clearly form an array; a single <item> is ambiguous and converts as a plain object. Feeds with varying counts need a normalization step (wrap-if-not-array) in consuming code.
Yes — RSS is XML, and the conversion yields channel/item structures ready for rendering. The item array is exactly the repeated-element case: normalize single-post feeds as above.
Comments, processing instructions, CDATA distinctions and namespace prefixes (usually flattened into key names). If the consumer needs them, JSON was the wrong target — those are XML-native concepts.
Approximately — the JSON to XML sibling reverses the conventions, but attribute order, whitespace and comments won't reappear. For data content, round trips are faithful; for document formatting, they aren't.

We use cookies for analytics and to keep the tools free via ads. See our Privacy Policy.