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 the tool, then paste the sample input below. Everything runs locally in your browser.
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
<order id="A-1001">
<status>paid</status>
<total currency="usd">4200</total>
</order>
Expected output
{
"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
- Paste the XML response.
- Convert it to JSON.
- Check how attributes and text nodes are mapped.
- Copy the JSON output.
- 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.
Convert, format, diff, query and validate JSON and API payloads — grouped in one place.
Practical example and expected result
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. In practice, this is most useful when you need a quick, repeatable check on a JSON payload before adding it to a ticket, pull request, test fixture, or support note.
A realistic input for this workflow is <order id="A-1001"> <status>paid</status> <total currency="usd">4200</total> </order>. The expected result should resemble { "order": { "@id": "A-1001", "status": "paid", "total": { "@currency": "usd", "#text": "4200" } } }, with the same important values preserved.
Troubleshooting checklist
- Confirm you copied the complete JSON payload and not only a partial line or truncated preview.
- Run the local tool once with a safe sample, then repeat with the real data only if your team policy allows it.
- Check quoting, escaping, whitespace, encoding, timestamps, and environment-specific values before trusting the result.
- Before sharing output, remove secrets, tokens, cookies, customer data, and production hostnames that are not needed for the review.
Next useful steps
- Open this example in XML to JSON Converter → for a related validation or follow-up step.
- Inspect SOAP XML with XPath for a related validation or follow-up step.
- Format the JSON output for a related validation or follow-up step.
- Use Magic Box when you are not sure which tool should handle the next artifact.