About the XML to JSON Converter
This tool converts XML to JSON directly in your browser. Paste XML text or open files such as .xml, .kml, .gpx, .svg, .rss or .txt. Choose JSON (values as text), JSON (numbers and true/false detected), or JSON on one line. The conversion runs locally on your device inside the page; nothing you type or open is uploaded to a server. The result is formatted JSON you can copy with one click or download as a file. Developers, data analysts and web editors use it to test APIs, clean feed data, or move legacy XML into JSON pipelines. The tool shows simple, predictable mapping so you can check attribute and element conversions quickly. It does not add server-side processing, which reduces privacy risk and avoids upload delays.
How to use it
- 1Paste XML or open an .xml, .kml, .gpx, .svg, .rss or .txt file
- 2Choose an output mode: JSON (values as text), JSON (numbers and true/false detected), or JSON on one line
- 3Click Convert
- 4Copy the JSON with one click or download the result file
Worked example
Input XML: <root><price>19.99</price><inStock>true</inStock><name>Widget</name></root> Output (JSON with numbers and true/false detected): {"root":{"price":19.99,"inStock":true,"name":"Widget"}}
How it works
Text tool that runs in the browserOptions: JSON (values as text), JSON (numbers and true/false detected), JSON on one lineOne click copies the outputVisitors can also open a file and download the resultNothing typed is uploadedSource: XSLT 3.0 - fn:xml-to-json / fn:json-to-xml (W3C)XPath and XQuery functions: json-to-xml / xml-to-json (W3C). Last checked 5 November 2026.
What it is good for
- Runs entirely in your browser; no upload of typed text or opened files
- Option to detect numbers and true/false so 19.99 becomes a number and true becomes a boolean
- One-click copy plus file open and download for quick workflows
- Does not preserve XML comments or processing instructions exactly
- No advanced per-tag rules like forcing an element into an array or custom namespace mapping
Questions people ask
Will my XML leave my computer?
No. The conversion runs in your browser and the site states nothing you type or open is uploaded. For highly sensitive data, keep using local tools or check your organisation policies.
How are numbers and booleans handled?
Pick the JSON option that detects numbers and true/false. The tool converts strings like 19.99 to numbers and true or false to booleans. Choose the plain text option if you want every value kept as a string.
How does the tool handle repeated tags?
When the same child tag repeats under a parent, the converter produces a JSON array for that key. Your code should handle both single objects and arrays when the input can vary.
Will attributes become JSON keys?
Attributes are converted to object properties according to the converter's mapping rules. If your XML uses attributes and mixed content, expect keys for attributes and for element text. Check the output to confirm the exact naming pattern.
Can I convert back to XML exactly?
Not always byte-for-byte. Converters typically follow a round-trip convention, but comments, processing instructions and exact namespace declarations may not be preserved. Use a JSON-to-XML tool that follows the same mapping for best results.
What file types can I open?
You can open .xml files and many XML-based files such as .kml, .gpx, .svg and .rss. You can also paste XML text directly into the input area.
Help keep every tool free
FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.