JSON to XML without uploading

Turn JSON into well-formed XML right in your browser, and your data is never uploaded. Lists become repeated tags, and names XML can't hold are made safe.

  • Files never uploaded
  • Clear, fixed rules
  • Well-formed XML
  • Free, no sign-up
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: .json 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 JSON to XML still works. Your browser's network panel (F12 on a computer) shows your JSON is never sent. Google's ad code loads here too; our code never gives it your JSON. How we prove it

    How to convert JSON to XML

    1. Paste or choose

      Paste JSON in the box, or choose files.

    2. Pick the options

      Or keep the usual ones.

    3. Copy or download

      Your XML, ready to use.

    When this tool isn't the right fit

    • A program needs XML that follows its own schema (XSD). The XML follows the rules on this page, not a schema. Rename the names in your JSON to match it first.
    • You must tell null from empty text, or keep empty lists. Both null and empty text make an empty element, and an empty list makes none.
    • You need comments or CDATA sections in the XML. This tool escapes text instead and writes no comments.
    • 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.

    JSON to XML: the complete guide

    The rules, safe names, the root element, real results and privacy.

    In this guide
    1. What it does
    2. Step by step
    3. The rules
    4. Safe names
    5. Real results
    6. The root element
    7. Big files
    8. Mistakes in the JSON
    9. A worked example
    10. Lists and empty values
    11. XML for a portal
    12. Attributes and text
    13. Special characters
    14. Privacy
    15. Compared with others
    16. Tips
    17. Limits
    18. Terms explained

    What JSON to XML does, and when you need it

    JSON and XML both hold data as plain text. JSON writes names and values in curly brackets, {"city": "Pune"}, and is what most web apps make today. XML wraps each value in tags, <city>Pune</city>, and is still what many older systems, portals and file formats expect. This page turns JSON into XML by fixed rules, shown below, so the same JSON always gives the same XML.

    Where it helps:

    • A portal, a bank's system or an older program that only accepts XML, when your data comes from an app as JSON.
    • A SOAP service, which speaks XML, fed from a JSON API.
    • An import into an accounting program that reads XML.
    • A feed or a report built with XML tools, such as XSLT, from JSON data.

    The result is well-formed XML, with the XML declaration at the top, that any XML reader accepts. It is made in your browser, in a background worker, and never uploaded.

    How to convert JSON to XML, step by step

    1. Paste JSON in the box, or press Try a sample for a made-up order, and press Convert to XML (or Ctrl+Enter).
    2. Or choose files: press Choose files, or drop .json files anywhere on the page. Each one is converted at once, in a row of its own.
    3. Choose the root element and the indent, explained below. Leave Root element empty to use the JSON's own top name when it has one.
    4. Read the line on the result: for the sample, “<order>, 16 elements”, with a note for each name that was made safe, such as “delivery note” becoming <delivery_note>.
    5. Copy or Download. A file keeps its name, so orders.json becomes orders.xml; JSON you pasted is saved as data.xml. Two or more results can be saved together with Download all as ZIP.

    How JSON becomes XML: the rules

    Every file is converted by the same rules, the reverse of XML to JSON's, so XML made there and turned into JSON comes back the same way.

    In the JSONIn the XML
    One name at the top whose value isn't a list {"order": {...}}The main element <order>
    Anything else: a list, several names, or a single valueEverything inside <root>, and the result says why
    A name typed in Root elementAlways the main element, with the JSON inside it
    "@id": 17An attribute id="17"
    "#text": "hello"The element's text
    "city": "Pune"<city>Pune</city>
    "item": ["a", "b"]<item>a</item><item>b</item>: a list repeats the element
    A list inside a list, or a list at the top<item> elements
    null or ""An empty element <note/>
    An empty list []No element; the result counts them
    true, 42, 3.50Their text, numbers exactly as written: 3.50 stays 3.50
    An object or list as an attribute or #textWritten as JSON text, and the result says so
    &, <, > and "&amp;, &lt;, &gt; and, in attributes, &quot;
    Control characters XML can't holdLeft out, and counted in the result

    The XML starts with <?xml version="1.0" encoding="UTF-8"?>. Names keep their order, and an element's text comes before its child elements.

    Names XML can't hold, made safe

    A JSON name can be anything; an XML name can't hold spaces or most punctuation, or start with a digit. Such names are changed the same way every time, and the result lists the first few:

    JSON nameXML name
    first namefirst_name: each character an XML name can't hold becomes _
    rate%rate_
    2024_2024: a name that starts with a digit, - or . gets _ in front
    An empty name ""_
    a:ba_b, unless "@xmlns:a" on that element or one above declares the prefix a; then it stays a:b
    नामनाम: Hindi and other letters are fine in XML names
    Two attributes that end up with the same nameThe second gets _2
    JSON to XML after converting its sample order: a 515-byte XML file of 16 elements, with the result shown
    Our sample JSON, turned into XML in the browser.

    Real results from our tests

    We tested JSON to XML 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, 15 that it should convert and 13 with mistakes, with the usual options and again with changed ones, and then the 50 MB file: 57 files in all. For every converted file, every saved XML was well-formed for Python's own XML reader (expat), with and without namespaces, started with the XML declaration, and held the elements, attributes and text the page's rules make from what Python's json module read. 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 list of orders, 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 JSON file0.1 s1.5 MB0 MB5 ms
    A 10 MB JSON file0.7 s15 MB165 MB11 ms
    A 50 MB JSON file4.0 s75 MB767 MB8 ms
    A 1.0 MB JSON file, on a phone-sized screen with the processor slowed 4 times0.4 s1.5 MB3 MB126 ms
    A 10 MB JSON file, on a phone-sized screen with the processor slowed 4 times1.6 s15 MB174 MB114 ms

    What the numbers mean: a 50 MB file took 4.0 seconds on the laptop, and the page was never kept waiting for more than 8 milliseconds while it worked, far too little to notice. With the processor slowed 4 times, roughly a mid-range phone, a 10 MB file took 1.6 seconds, and the page was never kept waiting for more than 126 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.

    The root element and indent

    An XML file must have exactly one main element, the root, around everything else; JSON has no such rule. So when the JSON has one name at the top whose value isn't a list, like the sample's {"order": {...}}, that name becomes the root, <order>. In every other case, a list, several top-level names, or a single value, everything goes inside <root>, and the result says why: for a list, “Everything is inside <root>, because the JSON is a list.”

    Type a name in Root element to choose it yourself, such as the name a portal's documentation asks for: it then always wraps the JSON, and it is made safe by the same rules as other names. Indent sets the layout: 2 spaces, 4 spaces, a tab, or one line for the smallest file. Changing either never redoes a finished result by itself: it says it was made before the change and offers a button such as “Redo with 4 spaces”.

    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 and written. In our tests a 50 MB file, a list of orders, took 4.0 seconds on a laptop, and the page was never kept waiting for more than 8 milliseconds. A big file needs memory, though: the browser used 767 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; 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 JSON has a mistake

    JSON with a mistake isn't guessed at. The row names the mistake with its line and column and shows the line with a ^ under the place; for JSON in the box, Show in the box puts the cursor there. The usual ones:

    • A comma after the last item, {"a": 1,}: “There is a comma after the last name and value here. JSON doesn't allow that: remove the comma.”
    • Single quotes, {'a': 1}: “Names must be in double quotes ("name"), not single quotes.”
    • A missing comma, {"a": 1 "b": 2}: “A comma is missing before this name.”
    • A comment: “JSON can't hold comments (// or /* */). Remove the comment.”
    • Python's True or None, from a print rather than json.dumps: “true and false are written in small letters in JSON: true.” and “None isn't allowed in JSON. Use null, or a number.”
    • A name without quotes, {a: 1}: “Names must be in double quotes: "a".”

    To check JSON on its own, with the same messages, use JSON Formatter.

    A worked example: the sample order

    The sample is a made-up order in JSON. With Root element empty, it becomes this XML:

    • {"order": {...}} has one name at the top, so <order> is the root, and its "@id" and "@date" become id="INV-2026-0417" date="2026-10-09".
    • "item": [ {...}, {...} ] makes two <item> elements, each with sku="..." from its "@sku", and <title>, <qty> and <price> inside; 180.00 stays 180.00.
    • "delivery note" has a space, which an XML name can't hold, so it becomes <delivery_note>, and its & is written &amp;.
    • "paid": true becomes <paid>true</paid>, and "coupon": null an empty <coupon/>.

    The result is 515 bytes, 16 elements, with one note: the renamed name. Typing export in Root element puts the same order inside <export>.

    Lists, empty values and nesting

    JSON lists have no direct match in XML, which repeats an element instead. So "phone": ["98...", "99..."] gives two <phone> elements one after the other, and a program reading the XML sees two phones. A list inside a list has no name for its items, so they become <item>: "rows": [[1, 2], [3, 4]] gives two <rows>, each with two <item>.

    Empty values need care, because XML can't tell some of them apart. null and an empty text both make an empty element, <coupon/>, while an empty list makes no element at all, and the result counts those. If a receiving program needs to see an element that is empty, give it null or "" rather than [].

    Making XML a portal or a program will accept

    A system that takes XML usually describes exactly what it wants, often in a schema (an XSD file) or a sample file: the root's name, the names and order of elements, which values are attributes. The page makes well-formed XML from whatever names your JSON has; it doesn't know any schema. So the way to get XML a portal accepts is to shape the JSON first:

    • Use the element names from the portal's sample, in the same order.
    • Put @ in front of the names that the sample has as attributes.
    • Type the sample's root name in Root element.

    Then compare the result with the sample file side by side, for example with Text Compare, before you upload it to the portal.

    Attributes, text and child elements

    XML has two places for a value, an attribute in the start tag or an element of its own, and JSON has only names. The page uses a common convention: a name that starts with @ becomes an attribute, and the name #text becomes the element's own text. So {"order": {"@id": 17, "#text": "hello", "a": 1}} gives <order id="17">hello <a>1</a></order>: the attribute in the tag, the text first, then the child element.

    An attribute can only hold text, so an object or a list given as an attribute or as #text is written as JSON text inside it, and the result says so. Choose attributes for short facts about an element, such as an id, a date or a currency, and elements for the data itself; when a portal's sample file shows which is which, follow it.

    Special characters and escaping

    Some characters have a job in XML, so inside text they are written as codes: & as &amp;, < as &lt; and > as &gt;, and in attributes " as &quot;. Any XML reader turns them back into the characters, so Leave it at the gate &amp; ring twice reads as the sample's note. A few control characters, invisible codes that XML can't hold at all, are left out, and the result counts them. Everything else, Hindi, emoji and accented letters among them, is written as it is in UTF-8.

    Private: your data stays on your device

    Your JSON 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 JSON 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.

    JSON to XML after converting its sample order: a 515-byte XML file of 16 elements, with 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 JSON to XML 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 rulesShown on this page, the reverse of XML to JSON'sOften not stated
    Names XML can't holdMade safe the same way every time, and listedVaries; some make invalid XML
    NumbersEvery digit as writtenSome round long numbers
    Offline and sign-upWorks once loaded; no sign-upNeeds the internet; sometimes an account

    Tips for XML other programs accept

    • Give the root the name the receiving program expects: its documentation or an example file shows it.
    • Write "@name" for a value that must be an attribute, and "#text" for an element's own text.
    • Check the result by turning it back with XML to JSON: the same rules in reverse give your JSON again.
    • A list of one item still makes one element, and an empty list makes none, so a program that needs the element should get at least one item.
    • Keep IDs in quotes in your JSON if a program reads them as text; the page writes numbers exactly as they are either way.
    • Data in a spreadsheet? Save it as CSV UTF-8, make JSON from it with CSV to JSON, and convert that here.

    Limits

    • Files up to 200 MB. Bigger files are not started: a browser tab would run out of memory.
    • No schema. The XML follows the rules on this page, not a schema (XSD) a program may need: rename elements there if it asks for other names.
    • Empty lists make no element, and null and empty text both make an empty element, so XML can't tell them apart.
    • Nesting deeper than 500 levels (an object or list inside another, 500 times over) isn't read.
    • Comments and CDATA aren't written: text is escaped instead.

    JSON and XML terms, explained

    JSON
    JavaScript Object Notation: data written as text, with names and values in { } and lists in [ ].
    XML
    Extensible Markup Language: data written as text with tags, like <city>Pune</city>.
    Root element
    The one element around everything else in an XML file.
    Attribute
    A name="value" in a start tag, like id="17" in <order id="17">; in the JSON, a name that starts with @.
    Well-formed
    XML any XML reader accepts: tags closed in the right order, one root element, valid names, & and < escaped.
    Escaping
    Writing & as &amp; and < as &lt; so that they aren't read as markup.
    Namespace
    A prefix like gst: tied to an address with xmlns:gst="...", so that names from different sources can't clash.

    Frequently asked questions

    Is JSON to XML 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 JSON 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 JSON to XML?

    Paste the JSON in the box and press Convert to XML, or drop .json files on the page. Choose the root element and indent, then Copy or Download the XML.

    How do I make an attribute instead of an element?

    Put @ in front of its name: {"order": {"@id": 17}} gives an order element with the attribute id="17". A name "#text" becomes the element's own text.

    How do I choose the root element?

    Type its name in Root element. Left empty, the JSON's one top name is used when it has one, and an element called root otherwise.

    What happens to lists?

    A list repeats its element: "item": ["a", "b"] gives two item elements, one holding a and one b. A list inside a list makes elements called item, and an empty list makes none.

    What happens to names with spaces or that start with a digit?

    They are made safe the same way every time: "delivery note" becomes delivery_note and "2026 sales" becomes _2026_sales, and the result lists the changes.

    Are numbers changed?

    No. Numbers are written exactly as in the JSON: 3.50 stays 3.50, and long numbers keep every digit.

    What happens to null and true?

    true and false are written as their text, and null and "" make an empty element, such as the sample's empty coupon.

    Is the XML valid?

    It is well-formed and namespace-well-formed, with the XML declaration at the top, so any XML reader accepts it. Whether it matches a schema a program needs depends on your names.

    Does it work with Hindi and other languages?

    Yes. The XML is UTF-8 and keeps the letters themselves, in text and in names: नाम is a valid XML name.

    My JSON has a mistake. What do I do?

    The row names it with its line and column and a ^ under the place. Fix that place and convert again; JSON Formatter shows the same messages.

    How big a JSON file can it convert?

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

    Can I convert several files at once?

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

    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