Convert XML to JSON in your browser: repeated tags become arrays, attributes map to @attributes, and mixed text to #text. Private, offline, and no uploads.
Runs entirely in your browser — your data never leaves your device.
How to use XML to JSON Converter
What it does & when you need it
You have an XML document — a SOAP response, an RSS feed, an old configuration
file, a sitemap — and the rest of your stack speaks JSON. This converter reads
XML with a real parser and emits pretty-printed JSON you can drop into a
JavaScript object, a test fixture, or a jq pipeline. It runs entirely in your
browser, so an internal payload full of hostnames and IDs never leaves your
machine.
How to use
Paste your XML into the input.xml buffer, press Sample for an
example, or Upload an .xml file.
Read the JSON in output.json as it updates live. If the document is
malformed, the status bar names the problem — a mismatched tag, an unclosed
element, or stray content after the root.
Press Copy JSON or Ctrl/Cmd + Enter to copy the result, then send
it to the JSON Formatter if you want to re-indent or
validate it further.
Things worth knowing
Repeated tags become arrays. A tag that appears once maps to a single value;
the same tag repeated under one parent maps to an array. That is the natural fit
for a list, but it means the shape depends on your data — one <item> looks
different from three, so code defensively if a list can hold a single element.
Attributes and text get reserved keys. Attributes are gathered under an
@attributes object, and when an element mixes its own text with child elements
that text lands under a #text key. A plain <name>Ada</name> simply collapses
to the string "Ada".
The conversion is deliberately lossy. Comments and processing instructions
are dropped, the order between mixed text and elements is not preserved, and
namespace prefixes survive only as part of the tag name. Entities such as
& and A, plus CDATA sections, are decoded to their literal text.
Going the other direction? Use JSON to XML.
The empty <hr/> becomes an empty string; <meta> keeps its attribute under @attributes.
Mixed text and markup
<p>Hello <b>world</b>!</p>
The element has both text and a child, so the text is placed under a #text key.
Frequently asked questions
How are repeated XML tags represented in the JSON?+
A tag that appears once becomes a single value, and a tag that repeats under the same parent becomes an array. So one <item> is an object or string, while three <item> siblings become an array of three. This mirrors how a list is naturally modelled, but it means the shape can change if your sample data happens to have only one element where more are possible.
Where do attributes and text go?+
Attributes are gathered into an "@attributes" object on the element, so <user id="1"> yields { "@attributes": { "id": "1" } }. When an element has both attributes or child elements and its own text, that text is stored under a "#text" key. A plain element with only text, like <name>Ada</name>, collapses to just the string "Ada".
Are entities and CDATA decoded?+
Yes. The five predefined entities (& < > " ') and numeric character references such as A and A are decoded to their characters in both text and attribute values. CDATA sections are read as literal text, so <![CDATA[<b>]]> becomes the string "<b>".
What is lost when converting XML to JSON?+
The conversion is intentionally lossy: comments and processing instructions are dropped, namespace prefixes are kept only as part of the tag name, and the relative order of text and elements in mixed content is not preserved because sibling text is concatenated. Whitespace between elements used purely for indentation is treated as insignificant and trimmed.
Is my XML uploaded anywhere?+
No. Parsing and serialization run entirely in your browser with a hand-written parser, so a config file or SOAP payload full of internal hostnames never leaves your machine, and the tool keeps working offline once the page has loaded.