Free, browser-based utilities for everyday developer workflows

Convert XML to JSON for API debugging

Legacy and SOAP APIs still return XML. Convert it to JSON so you can read the structure, run a JSONPath query, or diff two responses with the rest of your toolchain.

Open this example in XML to JSON Converter

Open the tool, then paste the sample input below. Everything runs locally in your browser.

Open this example in XML to JSON Converter →

The problem

A SOAP or legacy endpoint returns XML, but your tools and teammates speak JSON. Reading nested XML by eye is slow, and you cannot drop it into a JSON diff or a JSONPath query. Converting to JSON gives you a structure the rest of your workflow understands.

Sample input

XML response
<order id="A-1001">
  <status>paid</status>
  <total currency="usd">4200</total>
</order>

Expected output

JSON
{
  "order": {
    "@id": "A-1001",
    "status": "paid",
    "total": { "@currency": "usd", "#text": "4200" }
  }
}

Attributes become @-prefixed keys and element text becomes #text, so no information from the XML is lost.

How to do it

  1. Paste the XML response.
  2. Convert it to JSON.
  3. Check how attributes and text nodes are mapped.
  4. Copy the JSON output.
  5. Send it to a JSON diff or JSONPath query.

Common mistakes

  • Pasting XML with a SOAP envelope and forgetting the payload is nested inside it.
  • Expecting attributes and element text to merge into one value.
  • Namespace prefixes that make keys longer than expected.
  • Mixed content (text and child elements together) that maps awkwardly.
  • Assuming repeated elements always become an array even when there is only one.

Related tools

Related guides

FAQ

How are XML attributes represented in JSON?

Attributes are converted to keys prefixed with @, such as @id, so they do not collide with child element names. Element text content becomes a #text key when the element also has attributes.

Can I convert a SOAP response?

Yes. Paste the full response; the body is nested inside the SOAP envelope, so drill into the envelope and body keys to reach your payload.

Why did a single element not become an array?

XML has no array type, so a single repeated element converts to one object. Only elements that actually repeat become arrays.

Does converting lose any data?

No. Attributes, text, and nesting are all preserved using @ and #text conventions, so the JSON round-trips the XML structure.

Is my XML uploaded?

No. Conversion runs locally in your browser. Nothing is sent to a server.

XML to JSON conversion runs locally in your browser. Nothing is uploaded.

Explore more JSON and API contract tools

Convert, format, diff, query and validate JSON and API payloads — grouped in one place.

View the JSON & API contract toolkit →