Skip to content

XML to JSON Converter

Convert XML to JSON and JSON to XML, with a configurable attribute prefix, #text keys for element text and arrays for repeated tags.

XML to JSON Converter

246 chars
JSON output0 chars
Output will appear here...

Updated . Provided as is. Check the output before you rely on it in production.

How to use XML to JSON Converter

  1. 1

    Choose a direction

    Select XML to JSON or JSON to XML using the mode toggle at the top of the tool to set the conversion direction.

  2. 2

    Paste your input

    Paste your XML or JSON into the input panel on the left, or click Sample to load a worked example to convert.

  3. 3

    Adjust the prefix

    Change the attribute prefix if your data uses a marker other than @ to distinguish XML attributes from child elements.

  4. 4

    Copy the result

    Review the converted output in the right panel, then press Copy Output to send the result to your clipboard.

Questions and answers

What is an XML to JSON converter?
XML and JSON both describe nested data, but XML attributes and element text have no direct JSON form, so a converter needs mapping rules. This one parses XML with the browser's DOMParser, maps attributes to prefixed keys (@ by default) and text to #text, turns repeated tags into arrays, and converts JSON back to XML.
Is the XML to JSON converter free?
Yes. It works in your browser with no account and no request limits, so you can convert files as large as your browser can comfortably hold.
Does this converter store my data?
No. Parsing and serialization run locally using your browser's native DOMParser. Your XML and JSON never leave the page or reach a server.
How are attributes and repeated tags handled?
Attributes become keys prefixed with @ by default, which you can change. Repeated child elements that share a tag collapse into a JSON array automatically.
For AI agents: how to call this tool

Machine-readable contract, endpoints and examples. Humans can ignore this section.

Best Path For Builders

Browser workflow

Runs instantly in the browser with private local processing and copy/export-ready output.

Browser Workflow

This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.

/xml-json-converter/

For automation planning, fetch the canonical contract at /api/tool/xml-json-converter.json.