filetity
Values
Force an element to always be a list

One <item> becomes a value and two become a list, so the same document produces two different shapes depending on how many rows it happened to have. That is the usual reason code written against one export breaks on the next. Name the elements that should always be a list, separated by commas.

Your XML
JSON
LocalThis runs in your browser. Nothing you paste is sent anywhere.

XML -> JSON · Local tool

XML to JSON

Convert XML to JSON, with attributes, namespaces and repeated elements handled.

Last updated

How do I convert XML to JSON without uploading the file?

Paste the XML into filetity's converter, or open a file, and the JSON appears beside it. The parsing happens inside the browser tab, so a SOAP response or an export carrying real records is never uploaded. Attributes become keys prefixed with @ and an element's own text sits under #text, a convention that works because XML names can never start with either character, so a prefixed key cannot collide with a child element. Repeated elements become an array, and because XML cannot express a list of one, you can name the elements that should always be an array so one record and two records produce the same shape. Values stay as text by default, since XML has no types and coercing them silently destroys leading zeros and long identifiers. Broken XML gets the line and column where it stopped parsing.

  1. 01 / Your device

    the file stays here

  2. 02 / Browser memory

    the work runs locally

  3. 03 / Back to you

    saved on this device

When you would use this

Situations, not settings.

A SOAP or legacy API you have to consume
Enterprise systems still answer in XML. Paste the response and get the JSON shape your code expects, including the namespace prefixes and the attributes.
An RSS or sitemap feed you want to read as data
Feeds repeat their entries, and naming those elements as always-a-list means your code works whether the feed returned one item or forty.
An export that will not parse and will not say why
The line and column where it broke, and what was expected there, which is usually a stray ampersand or a tag that was never closed.

How it works / no cloud

A conversion engine, not an upload form.

The parser is written for this site and runs in the page, so it can report the line and column where a document stopped being valid rather than the word invalid on its own. Attributes are prefixed with @ and an element's own text sits under #text, because neither character can begin an XML name and so neither can collide with a child element.

  • Offline ready
  • Installable app
  • No file limit queue

Straight answers

No accordion. Nothing hidden.

Is it free?
Yes, with no watermark and no page limit.
Does it need an account?
No. There is no account system.
Is my file processed on my device?
Yes. The file is read by your browser and never uploaded. There is no server to send it to.
What formats are supported?
XML in, including namespaces, attributes, CDATA, comments and a DOCTYPE. JSON out, indented.
What are the limits?
No size limit beyond what your browser will hold in a text box. Comments, the XML declaration and the DOCTYPE are dropped, because JSON has nowhere to put them.
Does it work on mobile?
Yes, on any modern mobile browser. Large files are limited by the memory the phone gives the browser.
Does it work offline?
Yes, once the page has loaded. The tool keeps working with no network connection.
Why does one item come out as a value and two as a list?
Because XML has no way to say a list of one. A document with a single record looks structurally identical to one that never repeats, so every converter has to guess, and code written against a two-record export then breaks on a one-record one. This page lets you name the elements that should always be a list, which removes the guess.
What happens to attributes?
They become keys prefixed with @, so an id attribute is "@id". The prefix is not decoration: XML names cannot start with @ or #, so a prefixed key can never collide with a child element of the same name, which is the failure mode of converters that merge the two together.
Are numbers converted to numbers?
Not unless you ask. XML has no types, so every value is text, and turning "007123" into 7123 or a long account number into a rounded float destroys real data. Turn on the detection when you know the document is safe for it; it only converts a value that survives a round trip back to exactly the same characters.
Does it handle namespaces like soap: and atom:?
Yes, and the prefix is kept as part of the key, so soap:Envelope stays soap:Envelope and the xmlns declaration is kept as an attribute. Resolving prefixes to their full URIs has no agreed representation in JSON, and keeping what the author wrote is the only form that can be written back out unchanged.
What do I get when the XML is broken?
The line and the column where parsing stopped, and a sentence about what was expected there. A stray less-than sign in text, a closing tag that does not match its opening one and an unclosed element each get a different message, which is the difference between finding it in ten seconds and reading the whole document.

Keep working locally

3 available · more coming