XML to JSON for Postman and Power Automate Workflows
- Postman can convert XML responses to JSON using a built-in test script or pre-request script.
- Power Automate uses the xml() and json() expressions to parse and transform XML data.
- For manual inspection of responses, the browser converter gives you readable JSON in seconds.
Table of Contents
Developers and automation builders working with SOAP or XML-based APIs frequently need XML in JSON format — either for debugging, for feeding into a subsequent workflow step, or for storage. Postman handles XML-to-JSON conversion with a two-line test script. Power Automate uses built-in expressions. For quick manual inspection of any XML response, the browser converter is the fastest option with no scripting required.
Converting XML Responses to JSON in Postman
When Postman returns an XML response from a SOAP or REST API, you can inspect it as-is or convert it to a JSON object for use in assertions, environment variables, or chained requests.
The standard Postman approach uses the xml2Json helper function in a test script. In the Tests tab of your Postman request, add:
const jsonData = xml2Json(pm.response.text());
console.log(jsonData);
This converts the XML response body to a JavaScript object you can navigate and use in assertions. xml2Json is a Postman global — no import needed.
To save the JSON to an environment variable for use in subsequent requests: pm.environment.set('responseJson', JSON.stringify(jsonData));
For quick inspection without writing a test script, copy the XML response body, paste it into the browser XML to JSON converter, and view the structured JSON. This is faster for one-off debugging sessions.
Handling XML in Power Automate
Power Automate workflows often connect to legacy systems that return XML — particularly SOAP-based services integrated through the HTTP action or custom connectors.
To parse XML in Power Automate, use the xml() expression to parse the XML string into an internal object, then navigate it using xpath() expressions or dot notation.
For full XML-to-JSON conversion in a Power Automate flow, use the HTTP action to call an external conversion service, or use the Parse JSON action after using a custom connector that handles the XML-to-JSON mapping.
The most practical approach for simple XML from an HTTP response: use multiple xpath() expressions to extract the specific values you need rather than converting the entire XML document to JSON. For example: xpath(xml(body('HTTP')), '/Response/Status/text()') pulls out just the Status element value.
For complex XML that you need fully converted, a browser-based converter helps during development — convert a sample response, understand the JSON structure, then write your Power Automate expressions targeting the right paths.
Sell Custom Apparel — We Handle Printing & Free ShippingUsing the Browser Converter for Manual Inspection
During development and debugging, you'll often receive an unfamiliar XML response and need to quickly understand its structure before writing Postman scripts or Power Automate expressions.
The browser converter is the fastest path for this: copy the XML response from Postman's response body, paste into the converter, click Convert, and browse the resulting JSON. The JSON output shows the complete structure — all element names, attribute names, nesting hierarchy, and values — in a readable format.
This is particularly useful for SOAP responses with deep nesting and long namespace prefixes, which are hard to read in raw XML but immediately clear in structured JSON.
Once you understand the structure, you can write precise Postman assertions or Power Automate xpath expressions targeting the specific elements you need, rather than guessing at the path from the raw XML.
Other Developer Workflow Tools That Handle XML to JSON
Insomnia: Postman's main competitor. Handles XML API responses similarly — response body is available as raw text, and you can convert via the scripting interface.
curl + Python: For command-line API testing, pipe the curl output through Python xmltodict: curl https://api.example.com/endpoint | python3 -c "import xmltodict,json,sys;print(json.dumps(xmltodict.parse(sys.stdin.read()),indent=2))"
VS Code REST Client extension: Shows XML responses in the editor — pair with an XML formatter extension for readable output. For JSON, the xml-to-json conversion step still applies.
Azure Logic Apps: Same as Power Automate under the hood — uses the same xml() and xpath() expressions for XML data handling.
n8n: The open-source workflow automation tool has an XML node that converts XML to JSON natively as a workflow step, without needing custom expressions.
Inspect Your API XML Response
Paste any XML response and get clean JSON for debugging or documentation. Free.
Open Free XML to JSON ConverterFrequently Asked Questions
Is xml2Json available in all Postman versions?
xml2Json is available in Postman's test scripts. It may not be available in all Newman (Postman CLI) versions — check the Postman documentation for the current compatibility list.
Can Power Automate parse complex SOAP responses directly?
For simple SOAP responses, xpath() expressions work well. For complex multi-namespace SOAP envelopes, using a dedicated HTTP connector to an external conversion endpoint is often cleaner.
Does the browser converter handle Postman's SOAP responses?
Yes. Copy the raw XML from Postman's response body, paste into the converter, and get the JSON output. SOAP XML including envelopes and namespaces converts correctly.
Are there any Postman pre-built libraries for XML handling?
Postman includes xml2Json as a global helper. For more complex transformations, external npm libraries can be bundled into Postman scripts using the pm.require pattern (Postman v10+).

