XML to JSON without uploading

Turn XML into clean JSON right in your browser, and your file is never uploaded. Attributes, repeated tags and Hindi text follow clear rules, shown on this page.

  • Files never uploaded
  • Clear, fixed rules
  • Big files work
  • Free, no sign-up
Repeated tags
Values
Indent

How each part is converted: the rules.

Files you choose or drop on this page are converted at once, each in its own row: .xml or .txt.

    Getting ready…

    Quick facts from our tests

    Check it yourself: once the page has loaded, turn off Wi-Fi and mobile data, and XML to JSON still works. Your browser's network panel (F12 on a computer) shows your XML is never sent. Google's ad code loads here too; our code never gives it your XML. How we prove it

    How to convert XML to JSON

    1. Paste or choose

      Paste XML in the box, or choose files.

    2. Pick the options

      Or keep the usual ones.

    3. Copy or download

      Your JSON, ready to use.

    When this tool isn't the right fit

    • Your XML is a document with text and tags mixed, like a web page or the inside of a Word file. The words come through, but not their place among the tags. A tool made for that kind of document fits better.
    • The order between different tags matters. When a tag comes back after other tags, both go into one list, so their order among the others isn't kept.
    • A program needs the namespace addresses, not the prefixes. Names keep their prefixes as written, like gst:rate. Map the prefixes in your program.
    • Your file is bigger than 200 MB. A browser tab would run out of memory, so it isn't started. Split it into smaller files first.

    Why convert with PDFGuild

    More free tools

    Private like this one: your files stay on your device.

    XML to JSON: the complete guide

    The rules, the options, real results, big files, mistakes and privacy.

    In this guide
    1. What it does
    2. Step by step
    3. The rules
    4. The options
    5. Real results
    6. Big files
    7. Mistakes in the XML
    8. Languages and encodings
    9. A worked example
    10. A sitemap, and Always a list
    11. Back to XML
    12. Privacy and safety
    13. Compared with others
    14. Tips
    15. Limits
    16. Terms explained

    What XML to JSON does, and when you need it

    XML and JSON both hold data as plain text. XML wraps each value in tags, like <city>Pune</city>, and was the usual way to exchange data for years. JSON writes names and values in curly brackets, like {"city": "Pune"}, and is what most web apps, scripts and databases read today. This page turns XML into JSON by fixed rules, shown below, so you always know what you will get.

    Where it helps:

    • An export from an accounting or payroll program, such as Tally's XML export, that a newer app or a script needs as JSON.
    • A SOAP service's answer or an old system's XML feed, for a web app that speaks JSON.
    • A sitemap or an RSS feed, to see its links and dates as data.
    • Reading XML at all: nested tags with attributes are often easier to follow as indented JSON.

    Files are read in your browser, in a background worker, and never uploaded. A file with a mistake is not guessed at: the page names the mistake and where it is.

    How to convert XML to JSON, step by step

    1. Paste XML in the box, or press Try a sample for a made-up order, and press Convert to JSON (or Ctrl+Enter).
    2. Or choose files: press Choose files, or drop .xml files anywhere on the page. Each one is converted at once, in a row of its own.
    3. Pick the options: how repeated tags become lists, whether values stay text, and the indent. They are explained below.
    4. Read the line on the result: for the sample, “<order>, 15 elements”, with a note for anything left out, such as the 1 comment JSON has no place for.
    5. Copy or Download. A file keeps its name, so orders.xml becomes orders.json; XML you pasted is saved as data.json. Two or more results can be saved together with Download all as ZIP.

    How XML becomes JSON: the rules

    Every file is converted by the same rules, so a program that reads the JSON can count on them. They never change between files or visits.

    In the XMLIn the JSON
    The main element <order>...</order>One name at the top: {"order": {...}}
    An attribute id="17""@id": "17"
    An element with only text <city>Pune</city>"city": "Pune"
    An element with attributes and text <price currency="INR">180</price>"price": {"@currency": "INR", "#text": "180"}: attributes first, then #text, then child elements
    The same tag more than once <item>...</item><item>...</item>A list: "item": [..., ...], in order. With Always a list, every child element is a list, even when it appears once
    An empty element <note/>"note": ""
    A prefix <gst:rate> and xmlns:gst="..."Kept as written: "gst:rate", "@xmlns:gst"
    CDATA <![CDATA[a < b]]>Its text: "a < b"
    Comments, <?...?> instructions and <!DOCTYPE>Left out, and the result says how many comments
    Spaces and line breaks at the start and end of a textLeft out. xml:space="preserve" keeps them
    Text between child elements <p>Hello <b>you</b> there</p>Joined with a space: "#text": "Hello there". Its place among the child elements isn't kept
    Entities &amp;, &#2325; and the ones the file definesTheir characters: &, क
    Values like 42, 3.50, trueText by default: "42". With Detect numbers: 42, 3.50, true. 007, 1e5, +5 and numbers of more than 15 digits stay text, so nothing is rounded

    Names keep the order in which they first appear. When the same tag comes back later (<a/><b/><a/>), both a go into one list where the first one was, so the order between different tags isn't kept.

    The options, explained

    Repeated tags. List when repeated, the usual choice, makes a list only where a tag appears more than once: two <item> elements become "item": [...], one stays a single value. Always a list makes every child element a list, even one that appears once. That helps when a program reads the result: an order with one item and an order with three then have the same shape, and the program never has to check whether it got a list or not.

    Values. Keep as text is the safe choice: everything stays text, so a PIN code like 411001, a phone number or an ID with zeros in front keeps every character. Detect numbers turns plain numbers into JSON numbers and true or false into true and false: in the sample, 7 values change, such as "@qty": "2" becoming "@qty": 2. A value like 007, 1e5, +5 or one with more than 15 digits stays text, so nothing is ever rounded or loses a zero.

    Indent. 2 spaces, 4 spaces, a tab, or one line for the smallest file. Changing an option never redoes a finished result by itself: each one made before says so, and offers a button such as “Redo with Always a list”, or “Apply to all” for many files.

    XML to JSON after converting its sample order: an 838-byte JSON file with its attributes and Hindi text kept, and the result shown
    Our sample XML, turned into JSON in the browser.

    Real results from our tests

    We tested XML to JSON with headless Chromium 148, the open-source browser Chrome is built on, on a Windows laptop with an Intel Core i7-1185G7 and 32 GB of memory, on 1 November 2026. Other work was running on the laptop at the same time, so times vary a little from run to run: each time below is the middle one of 3 runs, each in a fresh browser.

    Checked against Python. Our test gave the page every file of our test set for this tool, 8 that it should convert and 13 with mistakes, with the usual options and again with changed ones, and then the 50 MB file: 43 files in all. For every converted file, Python's own XML reader (expat) read each XML file, the page's rules were applied a second time to what it read, and each saved JSON had the same values and, laid out by Python's json.dumps with the same indent, the same text byte for byte. Each of the 13 files with mistakes was refused, as Python refuses it too, with the page's message naming the mistake.

    Speed and memory. The test files were made up for these tests: a product catalogue, of 1 MB, 10 MB and 50 MB. The time is from choosing the file to its finished row, and the memory is what the whole browser added while it worked. “Page kept waiting” is the most that a timer on the page, set to tick every 50 milliseconds, was ever late: the work runs in a background worker, so the page itself stays free to answer a tap or a click.

    FileTimeResultMemory addedPage kept waiting
    A 1.0 MB XML file0.1 s1.5 MB0 MB3 ms
    A 10 MB XML file0.7 s15 MB114 MB69 ms
    A 50 MB XML file3.3 s74 MB702 MB70 ms
    A 1.0 MB XML file, on a phone-sized screen with the processor slowed 4 times0.4 s1.5 MB23 MB106 ms
    A 10 MB XML file, on a phone-sized screen with the processor slowed 4 times1.5 s15 MB179 MB109 ms

    What the numbers mean: a 50 MB file took 3.3 seconds on the laptop, and the page was never kept waiting for more than 70 milliseconds while it worked, less than a tenth of a second. With the processor slowed 4 times, roughly a mid-range phone, a 10 MB file took 1.5 seconds, and the page was never kept waiting for more than 109 milliseconds: on a phone, a big result's box starts closed and is filled when you open it, so the finished row appears at once.

    Big files: up to 200 MB

    The work runs in a background worker, a separate part of the browser, so the page keeps responding while a big file is read. In our tests a 50 MB file, a product catalogue, took 3.3 seconds on a laptop, and the page was never kept waiting for more than 70 milliseconds. A big file needs memory, though: the browser used 702 MB more while it worked, so on a phone or an older computer a file of a few tens of MB is the comfortable size. Stop, or the × on a row, ends the work at once.

    The result box shows the start of a big result, the first 20,000 characters, so the page doesn't slow down drawing millions of them; Download always saves all of it, and Copy works up to 10 MB. Files over 200 MB are not started, because a browser tab would run out of memory: split them first. On a phone, a big result's box starts closed, so its row, with Download and Copy, appears at once: tap Result to see the start of it.

    When the XML has a mistake

    A broken file isn't guessed at. The row names the mistake with its line and column, then shows the line with a ^ under the place; for XML in the box, Show in the box selects it. The usual mistakes and what the page says:

    • A lone &, as in R&D: “A lone & must be written as &amp; in XML.”
    • An HTML name, as in &nbsp;: “&nbsp; is a name from HTML that XML doesn't know. Write &#160; instead.”
    • Two main elements, as in <a>1</a><b/>: “There is a second main element, <b>, after </a>. An XML file has one main element: put both inside one.”
    • An attribute twice in one tag: “The attribute x appears twice in <a>.”
    • Tags closed in the wrong order, or a file that stops before its tags are closed, are named with the tag and the line where it was opened.

    Fix the place it names, in the box or in the file, and convert again.

    Hindi, other languages and encodings

    Hindi, Tamil, Bengali, Urdu, Chinese and emoji come through as they are: the JSON is UTF-8 and keeps the letters themselves, not \u codes, and an entity like &#2325; becomes its letter, क. A file that starts with a UTF-16 byte order mark is read as UTF-16, and one whose first line names another encoding, such as encoding="ISO-8859-1" or Windows-1252, is read in it; the result says so in both cases. A file that claims UTF-8 but has wrong bytes in it is still read, with � where the bytes were wrong, and a note saying so.

    A worked example: the sample order

    The sample is a made-up order: an <order> with an id, a date and a namespace, a customer, two items, a GST rate, a note in CDATA and a comment. With the usual options it becomes JSON like this:

    • <order id="INV-2026-0417" ...> becomes the one name at the top, "order", with "@id": "INV-2026-0417", "@date" and "@xmlns:gst" first.
    • The customer has two <name> elements, so "name" is a list: "Priya Sharma", then {"@lang": "hi", "#text": "प्रिया शर्मा"}, because the second one has an attribute.
    • The two <item> elements make "item": [...], and each <price currency="INR">180.00</price> becomes {"@currency": "INR", "#text": "180.00"}.
    • <gst:rate>5</gst:rate> keeps its prefix: "gst:rate": "5". The CDATA note is plain text, its & included, and the comment is left out, as the result's note says.

    The whole result is 838 bytes with 2 spaces. With Always a list and Detect numbers it is 1,044 bytes: every child element is in [ ], and 7 values, such as the PIN code and the quantities, are numbers.

    A sitemap, and why Always a list helps

    A website's sitemap.xml lists its pages, each in a <url> with its <loc> and <lastmod>. With two pages it becomes {"urlset": {"@xmlns": "http://www.sitemaps.org/schemas/sitemap/0.9", "url": [{"loc": "https://example.com/", "lastmod": "2026-11-01"}, ...]}}: a list of pages, ready for a script.

    With only one page, though, "url" is a single object instead of a list, because the tag appears once. A script that expects a list then breaks on the smaller file. Always a list avoids that: "url" is a list of one, and each "loc" and "lastmod" a list too, so every file has the same shape. That is the choice to make whenever a program, not a person, reads the JSON.

    Turning the JSON back into XML

    JSON to XML follows these rules in reverse, so XML that went through this page comes back the same way: the attributes from the @ names, the text from #text, a list as the same tag repeated. The sample order comes back with every element, attribute and value it had, the Hindi name and the gst: prefix included.

    Three things don't come back, because JSON has no place for them: comments, the CDATA wrapping (its text comes back with & written as &amp;, which means the same), and the exact place of text that stood between child elements. For data files, such as orders, exports and feeds, that changes nothing a program reads.

    Private and safe: no upload, nothing fetched

    Your XML never leaves your device. The converter runs inside your browser, in a background worker on your own phone or computer, and has no upload step: it never sends your file or the text you paste anywhere. The page's Content Security Policy lets it contact only this site and Google's ad service, which pays for the site; our code never gives your files to the ad code. You can check it yourself in your browser's network panel (F12 on a computer): converting a file adds no request that carries it.

    Nothing you paste is run as code. The XML is read by our own small reader, written for this site, which only reads text: there is no eval and no step that runs anything from the file.

    Nothing is fetched from inside the file. An XML file can point to other files and addresses: a DTD (<!DOCTYPE ... SYSTEM "...">) or an outside entity (<!ENTITY x SYSTEM "...">), the trick behind "XXE" attacks. Browsers' own XML reader (DOMParser) doesn't fetch them either. Our reader runs in a background worker, where browsers have no DOMParser, and it has no code that loads anything: an outside entity is refused with a message, and a <!DOCTYPE> is left out. Entities a file defines for itself are expanded up to 10 million characters, then the reader stops, so an "entity bomb" (billion laughs) can't freeze your device.

    XML to JSON after converting its sample order: an 838-byte JSON file with its attributes and Hindi text kept, and the result shown, at a phone's size with the internet switched off by our test, between our test's bands that read "Internet switched off" and "Nothing uploaded: 0 requests sent data"
    Proof from our testOn 9 November 2026, our test opened XML to JSON at a phone's size, switched the internet off and ran it on its built-in sample. It finished with no connection, and none of the page's 19 requests sent any data.How we test, and how to check it yourself

    Compared with converters that upload your file

    This pageA converter that uploads
    Where your file goesNowhere: it is converted in your browserTo the site's server
    SizeUp to 200 MBOften a few MB, the upload limit
    The rulesShown on this page, the same for every fileOften not stated
    A mistake in the XMLNamed, with its line, column and a ^Varies
    Outside files the XML namesNever fetchedDepends on the server's reader
    Offline and sign-upWorks once loaded; no sign-upNeeds the internet; sometimes an account

    Tips for clean JSON

    • Always a list when a program will read the result: every repeated part then has the same shape.
    • Keep as text for IDs, PIN codes and phone numbers, so no zero in front is lost.
    • One line for the smallest file to send or store.
    • To tidy or check the JSON afterwards, use JSON Formatter; to open it in Excel, JSON to CSV.
    • For the way back, JSON to XML follows the same rules in reverse.

    Limits

    • Files up to 200 MB. Bigger files are not started: a browser tab would run out of memory. Split them first.
    • Text mixed with tags (like a web page or the XML inside a Word file) loses its place among the tags: the text goes into #text, joined with spaces.
    • Order between different tags isn't kept when the same tag comes back later: both go into one list.
    • Comments, <?...?> instructions and <!DOCTYPE> are left out: JSON has no place for them.
    • DTDs: default attribute values they declare are not added, entities that point to other files are refused, and entities that hold tags aren't expanded.
    • Prefixes are kept as written, not replaced with their namespace addresses, and an undeclared prefix isn't reported.
    • Nesting deeper than 500 levels (an element inside another, 500 times over) isn't read.

    XML and JSON terms, explained

    XML
    Extensible Markup Language: a way to write data as text with tags, like <city>Pune</city>.
    JSON
    JavaScript Object Notation: a way to write data as text, with names and values in { } and lists in [ ].
    Element and tag
    The <name>...</name> pair and everything inside it; <name/> is an empty one.
    Attribute
    A name="value" inside a start tag, like id="17" in <order id="17">.
    Namespace and prefix
    The gst: in gst:rate, declared with xmlns:gst="..." so that names from different sources can't clash.
    CDATA
    A part of the text written as it is, between <![CDATA[ and ]]>, so < and & in it need no escaping.
    Entity
    A name for a character, like &amp; for & or &#2325; for क.
    Array or list
    A JSON list: values in order, in [ ].

    Frequently asked questions

    Is XML to JSON free?

    Yes. There is no sign-up, no limit on how often you use it and no watermark. Ads from Google help pay for the site, and they are kept apart from the tool.

    Is my XML file uploaded anywhere?

    No. It is read and converted in your browser, in a background worker on your own device; the page has no upload step and keeps working with the internet switched off once loaded.

    How do I convert XML to JSON?

    Paste the XML in the box and press Convert to JSON, or drop .xml files on the page. Pick the options, then Copy or Download the JSON.

    How are attributes converted?

    Each becomes a name with @ in front: an attribute id="17" gives "@id": "17", before the element's text and its child elements.

    Why is one element a list and another not?

    With List when repeated, only a tag that appears more than once becomes a list. Choose Always a list to make every child element a list.

    What happens to the text inside an element that also has attributes?

    It goes in "#text": a price element with currency="INR" and the text 180 becomes {"@currency": "INR", "#text": "180"}.

    Are numbers kept as numbers?

    Values stay text by default, so nothing changes. With Detect numbers, plain numbers and true or false become JSON numbers and true or false; 007, 1e5 and long numbers stay text.

    What happens to namespaces and prefixes?

    Prefixes are kept as written: the element gst:rate becomes "gst:rate", and its declaration xmlns:gst becomes "@xmlns:gst".

    What happens to comments and CDATA?

    Comments are left out, because JSON has no place for them, and the result says how many. CDATA is read as ordinary text.

    Does it work with Hindi and other languages?

    Yes. The JSON is UTF-8 and keeps the letters themselves, and files in UTF-16 or an encoding named in the XML's first line are read in it.

    My XML has a mistake. What do I do?

    The row names it with its line and column and a ^ under the place. Fix that place, in the box or the file, and convert again: the page never guesses.

    How big an XML file can it convert?

    Up to 200 MB. In our tests a 50 MB file took 3.3 seconds on a laptop, and the page kept responding the whole time.

    Can I convert several XML files at once?

    Yes. Choose or drop as many as you like: each is converted in its own row, and Download all as ZIP saves them together.

    Is it safe to open an XML file from someone else?

    Yes. Nothing in the file is run, and nothing it points to is fetched: outside entities are refused, and self-defined entities stop at 10 million characters, so an entity bomb can't freeze your device.

    Does it work offline?

    Yes. Once the page has loaded, switch off the internet and it keeps working, because everything happens in your browser.

    By the PDFGuild team · Updated · How we test