About XML to JSON
XML and JSON describe the same kind of tree with different syntax, but a naive converter loses information: attributes vanish, repeated elements overwrite each other and namespaces collapse. This converter uses one predictable mapping instead. Attributes become keys with an @ prefix, child elements become keys with repeated names collected into arrays, and text inside an element that also has attributes or children is kept under #text.
Namespaces are preserved by keeping the prefix in element and attribute names, and the xmlns declarations appear as ordinary attributes, so the document keeps its meaning. The XML is parsed with the browser's DOMParser, which reports malformed documents with a message and a position. Both the mapping options and the conversion run locally; nothing is uploaded.
What this tool does
Predictable JSON shape
Attributes become @ keys, repeated children become arrays, text-only elements become strings and empty elements become null, so the same XML always gives the same JSON.
Configurable attribute prefix
Keep the default @ or type another prefix such as $ or _ when the receiving system reserves the @ character.
Array handling option
Use arrays only for repeated children, or wrap every child element in an array when a downstream schema always expects lists.
Namespaces preserved
Prefixed element and attribute names stay prefixed and xmlns declarations are kept as attributes instead of being silently dropped.
Well-formedness errors with position
Malformed XML is reported with the parser message and the line and column where parsing stopped, not as a generic failure.
Copy, download, no upload
Copy the JSON or download it as a .json file; the XML is read locally in the browser and never sent to a server.
How to use XML to JSON
- 01
Paste or load XML
Paste the document into the input pane or load an .xml file from your device; files up to 10 MB are accepted.
- 02
Set the mapping options
Choose an attribute prefix and whether arrays are used only for repeated children or for every child element.
- 03
Convert to JSON
Press Convert. The XML is validated with DOMParser and converted into the predictable JSON shape described above.
- 04
Review the result
Read the JSON output, checking attribute keys, arrays and any #text fields, and fix parser errors if they are reported.
- 05
Copy or download
Copy the JSON to the clipboard or download it as a .json file named after the uploaded document.
Supported formats and limits
- Input
- XML
- Output
- JSON
- Processing
- Client-side, in your browser. Nothing is uploaded.
- Maximum size
- Bound by the memory available to your browser tab.
- Requirements
- Chrome, Edge, Firefox or Safari · JavaScript enabled
Limitations worth knowing
- Comments, processing instructions and doctype declarations are ignored in the JSON output.
- Text is trimmed and internal whitespace collapsed, so whitespace-only formatting and intentional edge spaces are lost.
- Mixed content with several text and element runs is aggregated: all text goes into one #text value rather than keeping strict order.
- Input is capped at 10 MB of XML and conversion runs on the main thread after a short yield.
Privacy and file handling
Your XML is read, parsed and converted entirely inside this browser tab. The document is never uploaded to FormatFlow or anyone else, no copy is stored and nothing leaves your device; closing the page clears the input and the JSON result.
Read the full privacy policy
