🛠️DevTools

SOAP Response to JSON

SOAP XML responses including namespaces convert to JSON for easier processing in modern applications.

Switch tool:
Examples:
JSON output will appear here...

💡 Paste your XML and it converts to JSON automatically. Attributes are prefixed with @ and text content uses #text.

Code Examples

Here's how to achieve this in different programming languages:

1// Using DOMParser (browser) or xml2js (Node.js)
2const xmlString = `<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
3 <soap:Body>
4 <GetUserResponse>
5 <user>
6 <id>123</id>
7 <name>John Doe</name>
8 </user>
9 </GetUserResponse>
10 </soap:Body>
11</soap:Envelope>`;
12
13// Browser
14const parser = new DOMParser();
15const doc = parser.parseFromString(xmlString, 'text/xml');
16
17// Node.js with xml2js (npm install xml2js)
18const xml2js = require('xml2js');
19const parser = new xml2js.Parser();
20parser.parseString(xmlString, (err, result) => {
21 console.log(JSON.stringify(result, null, 2));
22});
23
24// Output:
25// {
26// "soap:Envelope": {
27// "@xmlns:soap": "http://schemas.xmlsoap.org/soap/envelope/",
28// "soap:Body": {
29// "GetUserResponse": {...

More XML Examples

Related XML Tools

📚 Learn More