Share via

Retreiving XML tab value from JSON response object in Azure Data Factory Web Activity

sachin gupta 376 Reputation points
2021-12-21T22:11:06.82+00:00

Hello,159502-bings.png

I have created a web activity which is calling the Bings API. The response is coming as a JSON. One of the JSON attribute value is an XML string and I need to retrieve the value of "ReportRequestId" from the attached response. I tried couple of things like converting the XML into JSON and then retrieving the nested values from the json object, but nothing worked. Below are the few expressions which I tried Can someone guide on how I can get this value?

@json (xml(activity('WebActivity').output.Response)).Envelope.Body.SubmitGenerateReportResponse.ReportRequestId

@json (replace(string(xml(activity('WebActivity').output.Response)), ':','')).Envelope.Body.SubmitGenerateReportResponse.ReportRequestId

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.


1 answer

Sort by: Most helpful
  1. svijay-MSFT 5,256 Reputation points Microsoft Employee Moderator
    2021-12-22T21:00:54.083+00:00

    Hello @sachin gupta ,

    Thanks for the question and using MS Q&A platform.

    You could try use the xpath

    Reference : https://learn.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions#xpath

    xpath path function check XML for nodes or values that match an XPath (XML Path Language) expression, and return the matching nodes or values.

    You could share me the sample xml output here as a text so that I could try it at my end.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.