CalculatorsConvertersDeveloperTextAll toolsDirectory
Submit your tool Sign in
Theme
Home/Answers/Data
How-to

How do I convert XML to JSON?

Short answer

Paste the XML into a browser-based converter and it produces a JSON representation of the same tree, entirely on your device. That is the practical way to get data out of a legacy API, an RSS feed or a SOAP response and into a format modern tooling understands, without uploading the payload anywhere.

There is no single official mapping

XML has features JSON does not, notably attributes and mixed text content, so there is no one canonical XML-to-JSON mapping. Converters typically turn elements into keys, repeated elements into arrays, and mark attributes with a prefix. The output is predictable once you see one example, but it is worth checking how attributes came through before wiring the result into code.

Where XML still shows up

Plenty of real systems still speak XML: SOAP services, RSS and Atom feeds, sitemaps, invoice formats and enterprise integrations. Converting a response to JSON in the browser is the fastest way to explore it, and because the conversion is client-side you can safely paste real responses that contain account or business data.

Step by step

  1. Paste the XML. Paste the XML document or response into the converter.
  2. Convert locally. The tool parses the XML in your browser and builds the JSON tree.
  3. Copy the JSON. Copy the JSON output for use in your code or other tools.

Frequently asked questions

Is the XML sent to a server?

No. The document is parsed and converted entirely in your browser.

How are attributes handled?

Attributes are kept in the JSON output, usually distinguished from child elements by a prefix, since JSON has no native attribute concept.

Does it work with RSS and SOAP responses?

Yes. Any well-formed XML converts, including feeds and SOAP envelopes.

Related answers